@corva/ui 3.76.0-1 → 3.76.0-10

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.
Files changed (85) hide show
  1. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js +1 -1
  2. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
  3. package/cjs-bundle/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
  4. package/cjs-bundle/components/AttachmentPreview/useScrollOverflow.js +2 -0
  5. package/cjs-bundle/components/AttachmentPreview/useScrollOverflow.js.map +1 -0
  6. package/cjs-bundle/components/Comment/index.js +1 -1
  7. package/cjs-bundle/components/Comment/index.js.map +1 -1
  8. package/cjs-bundle/components/Comment/useComment.js +2 -0
  9. package/cjs-bundle/components/Comment/useComment.js.map +1 -0
  10. package/cjs-bundle/components/CommentCard/CommentCard.scss.js +1 -1
  11. package/cjs-bundle/components/CommentInput/index.js +1 -1
  12. package/cjs-bundle/components/CommentInput/index.js.map +1 -1
  13. package/cjs-bundle/components/CommentInput/useCommentInput.js +2 -0
  14. package/cjs-bundle/components/CommentInput/useCommentInput.js.map +1 -0
  15. package/cjs-bundle/components/CommentInputNext/CommentInputNext.scss.js +1 -1
  16. package/cjs-bundle/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  17. package/cjs-bundle/components/FeedCard/FeedCard.scss.js +1 -1
  18. package/cjs-bundle/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
  19. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
  20. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
  21. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  22. package/cjs-bundle/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
  23. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  24. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
  25. package/cjs-bundle/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
  26. package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
  27. package/cjs-bundle/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
  28. package/components/AttachmentPreview/AttachmentPreview.d.ts +1 -0
  29. package/components/AttachmentPreview/AttachmentPreview.d.ts.map +1 -1
  30. package/components/AttachmentPreview/AttachmentPreview.js +1 -1
  31. package/components/AttachmentPreview/AttachmentPreview.js.map +1 -1
  32. package/components/AttachmentPreview/AttachmentPreview.scss.js +1 -1
  33. package/components/AttachmentPreview/__tests__/AttachmentPreview.overflow.test.d.ts +2 -0
  34. package/components/AttachmentPreview/__tests__/AttachmentPreview.overflow.test.d.ts.map +1 -0
  35. package/components/AttachmentPreview/useScrollOverflow.d.ts +16 -0
  36. package/components/AttachmentPreview/useScrollOverflow.d.ts.map +1 -0
  37. package/components/AttachmentPreview/useScrollOverflow.js +2 -0
  38. package/components/AttachmentPreview/useScrollOverflow.js.map +1 -0
  39. package/components/Comment/__tests__/useComment.test.d.ts +2 -0
  40. package/components/Comment/__tests__/useComment.test.d.ts.map +1 -0
  41. package/components/Comment/index.d.ts +2 -22
  42. package/components/Comment/index.js +1 -1
  43. package/components/Comment/index.js.map +1 -1
  44. package/components/Comment/useComment.d.ts +22 -0
  45. package/components/Comment/useComment.d.ts.map +1 -0
  46. package/components/Comment/useComment.js +2 -0
  47. package/components/Comment/useComment.js.map +1 -0
  48. package/components/CommentCard/CommentCard.scss.js +1 -1
  49. package/components/CommentInput/__tests__/useCommentInput.test.d.ts +2 -0
  50. package/components/CommentInput/__tests__/useCommentInput.test.d.ts.map +1 -0
  51. package/components/CommentInput/index.d.ts +26 -24
  52. package/components/CommentInput/index.js +1 -1
  53. package/components/CommentInput/index.js.map +1 -1
  54. package/components/CommentInput/useCommentInput.d.ts +26 -0
  55. package/components/CommentInput/useCommentInput.d.ts.map +1 -0
  56. package/components/CommentInput/useCommentInput.js +2 -0
  57. package/components/CommentInput/useCommentInput.js.map +1 -0
  58. package/components/CommentInputNext/CommentInputNext.scss.js +1 -1
  59. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts +2 -9
  60. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.d.ts.map +1 -1
  61. package/components/DevCenter/DevCenterAppContainer/DevCenterAppContainer.js.map +1 -1
  62. package/components/FeedCard/FeedCard.scss.js +1 -1
  63. package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts +19 -6
  64. package/componentsV2/AppCommonsProvider/AppCommonsContext.d.ts.map +1 -1
  65. package/componentsV2/AppCommonsProvider/AppCommonsContext.js.map +1 -1
  66. package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts +1 -0
  67. package/componentsV2/AppHeader/V3/Actions/Actions.constants.d.ts.map +1 -1
  68. package/componentsV2/AppHeader/V3/Actions/Actions.constants.js +1 -1
  69. package/componentsV2/AppHeader/V3/Actions/Actions.constants.js.map +1 -1
  70. package/componentsV2/AppHeader/V3/Actions/Actions.d.ts.map +1 -1
  71. package/componentsV2/AppHeader/V3/Actions/Actions.js +1 -1
  72. package/componentsV2/AppHeader/V3/Actions/Actions.js.map +1 -1
  73. package/componentsV2/AppHeader/V3/AppHeaderV3.d.ts.map +1 -1
  74. package/componentsV2/AppHeader/V3/AppHeaderV3.js +1 -1
  75. package/componentsV2/AppHeader/V3/AppHeaderV3.js.map +1 -1
  76. package/componentsV2/AppHeader/V3/AppHeaderV3.scss.js +1 -1
  77. package/componentsV2/AppHeader/V3/useResponsivity.js +1 -1
  78. package/componentsV2/AppHeader/V3/useResponsivity.js.map +1 -1
  79. package/componentsV2/AppHeader/__tests__/AppHeaderEmbedded.test.d.ts +2 -0
  80. package/componentsV2/AppHeader/__tests__/AppHeaderEmbedded.test.d.ts.map +1 -0
  81. package/mcp-server/server.mjs +7 -3
  82. package/package.json +1 -1
  83. package/styles/common.scss +14 -0
  84. package/styles/mixins.scss +14 -0
  85. package/tsconfig.tsbuildinfo +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("react"),n=require("../AttachmentLightbox/useAttachmentLightbox.js"),o=require("./AttachmentRow.js"),i=require("./SortableAttachments.js"),c=require("react/jsx-runtime");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(e),l=a(t),s=["onReorder","onItemClick","onShare"];function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){u.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=r.forwardRef((function(e,t){var r=e.onReorder,a=e.onItemClick,u=e.onShare,b=l.default(e,s),f=n.useAttachmentLightbox(b.items,{onShare:u}),p=f.openAttachment,m=f.lightbox;if(!b.items.length)return null;var j=!!r&&b.items.length>1?c.jsx(i.SortableAttachments,h(h({},b),{},{ref:t,onReorder:r,onItemClick:null!=a?a:p})):c.jsx(o.AttachmentRow,h(h({},b),{},{ref:t,onShare:u,onItemClick:null!=a?a:p}));return c.jsxs(c.Fragment,{children:[j,!a&&m]})}));exports.AttachmentPreview=f;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var s=require("@babel/runtime/helpers/defineProperty"),o=require("@babel/runtime/helpers/objectWithoutProperties"),e=require("react"),c=require("../../componentsV2/ButtonIcon/ButtonIcon.js"),n=require("../../componentsV2/Tooltip/Tooltip.js"),i=require("../../icons/iconParkIcons.js");require("../../icons/customIcons/icons/AddMessage.js"),require("../../icons/customIcons/icons/DragOne.js"),require("../../icons/customIcons/icons/Attention.js"),require("../../icons/customIcons/icons/Collapse.js"),require("../../icons/customIcons/icons/Dashboard.js"),require("../../icons/customIcons/icons/Expand.js"),require("../../icons/customIcons/icons/FolderClosed.js"),require("../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../icons/customIcons/icons/FolderOpened.js"),require("../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../icons/customIcons/icons/LessOrEqual.js"),require("../../icons/customIcons/icons/Search.js"),require("../../icons/customIcons/icons/SearchOne.js"),require("../../icons/customIcons/icons/Wellhub.js"),require("../../icons/customIcons/icons/MultiRuler.js"),require("../../icons/customIcons/icons/Checkbox.js"),require("../../icons/customIcons/icons/CheckboxChecked.js"),require("../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../icons/customIcons/icons/Radio.js"),require("../../icons/customIcons/icons/RadioChecked.js"),require("../../icons/customIcons/icons/SimulFrac.js"),require("../../icons/customIcons/icons/ZipperFrac.js"),require("../../icons/customIcons/icons/CautionFilled.js"),require("../../icons/customIcons/icons/InfoRounded.js"),require("../../icons/customIcons/icons/FlameFilled.js"),require("../../icons/customIcons/icons/MoreApp.js"),require("../../icons/customIcons/icons/Pad.js"),require("../../icons/customIcons/icons/DrilloutUnit.js"),require("../../icons/customIcons/icons/FracFleet.js"),require("../../icons/customIcons/icons/Global.js"),require("../../icons/customIcons/icons/Program.js"),require("../../icons/customIcons/icons/Rig.js"),require("../../icons/customIcons/icons/Well.js"),require("../../icons/customIcons/icons/Gap.js"),require("../../icons/customIcons/icons/Pin.js"),require("../../icons/customIcons/icons/PinOne.js"),require("../../icons/customIcons/icons/PinOneCrossed.js"),require("../../icons/customIcons/icons/CloseOneFilled.js"),require("../../icons/customIcons/icons/AttentionFilled.js"),require("../../icons/customIcons/icons/CheckOneFilled.js"),require("../../icons/customIcons/icons/Archive.js"),require("../../icons/customIcons/icons/ArchiveCancel.js"),require("../../icons/customIcons/icons/Unarchive.js"),require("../../icons/customIcons/icons/Archived.js"),require("../../icons/customIcons/icons/InterventionUnit.js"),require("../../icons/customIcons/icons/CloudDelete.js"),require("../../icons/customIcons/icons/Lasso.js"),require("../../icons/customIcons/icons/Radius.js"),require("../../icons/customIcons/icons/ErrorOps.js"),require("../../icons/customIcons/icons/DataTypeOps.js"),require("../../icons/customIcons/icons/FalsePositiveOps.js"),require("../../icons/customIcons/icons/CalibrationOps.js"),require("../../icons/customIcons/icons/CriticalOps.js"),require("../../icons/customIcons/icons/Company.js"),require("../../icons/customIcons/icons/ArchiveOne.js"),require("../../icons/customIcons/icons/ParseBotFusion.js"),require("../../icons/customIcons/icons/Connect.js"),require("../../icons/customIcons/icons/PuzzleOne.js"),require("../../icons/customIcons/icons/Feed.js"),require("../../icons/customIcons/icons/Prompt.js"),require("../../icons/customIcons/icons/Companies.js"),require("../../icons/customIcons/icons/ClipboardAi.js"),require("../../icons/customIcons/icons/Key.js"),require("../../icons/customIcons/icons/AtSignCrossed.js"),require("../../icons/customIcons/icons/MappingManual.js"),require("../../icons/customIcons/icons/Mapping.js"),require("../../icons/customIcons/icons/Metrics.js"),require("../../icons/customIcons/icons/Drops.js"),require("../../icons/customIcons/icons/ClipboardSearch.js"),require("../../icons/customIcons/icons/Template.js"),require("../../icons/customIcons/icons/ClipboardMetrics.js"),require("../../icons/customIcons/icons/ClipboardBuilder.js"),require("../../icons/customIcons/icons/UnitConversion.js"),require("../../icons/customIcons/icons/NPT.js"),require("../../icons/customIcons/icons/GuidedFrac.js");var r=require("../AttachmentLightbox/useAttachmentLightbox.js"),t=require("./AttachmentRow.js"),u=require("./SortableAttachments.js"),l=require("./useScrollOverflow.js"),m=require("./AttachmentPreview.scss.js"),a=require("react/jsx-runtime");function j(s){return s&&"object"==typeof s&&"default"in s?s:{default:s}}var q=j(s),I=j(o),d=["onReorder","onItemClick","onShare"];function h(s,o){var e=Object.keys(s);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(s);o&&(c=c.filter((function(o){return Object.getOwnPropertyDescriptor(s,o).enumerable}))),e.push.apply(e,c)}return e}function p(s){for(var o=1;o<arguments.length;o++){var e=null!=arguments[o]?arguments[o]:{};o%2?h(Object(e),!0).forEach((function(o){q.default(s,o,e[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(e)):h(Object(e)).forEach((function(o){Object.defineProperty(s,o,Object.getOwnPropertyDescriptor(e,o))}))}return s}var f=function(s){return 1===s?"1 more attachment":"".concat(s," more attachments")},b=function(s){var o=s.direction,e=s.hiddenCount,r=s.onClick;if(!e)return null;var t=1===o;return a.jsx(n.Tooltip,{title:f(e),children:a.jsx("div",{className:t?m.scrollArrowRight:m.scrollArrowLeft,children:a.jsx(c.ButtonIcon,{size:"xs",type:"tertiaryBg",ariaLabel:f(e),onClick:function(){return r(o)},testId:t?"attachment-scroll-right":"attachment-scroll-left",children:t?a.jsx(i.RightIcon,{size:"small"}):a.jsx(i.LeftIcon,{size:"small"})})})})},C=e.forwardRef((function(s,o){var c=s.onReorder,n=s.onItemClick,i=s.onShare,j=I.default(s,d),q=r.useAttachmentLightbox(j.items,{onShare:i}),h=q.openAttachment,f=q.lightbox,C=e.useRef(null),O=e.useCallback((function(s){C.current=s,"function"==typeof o?o(s):o&&(o.current=s)}),[o]),g=l.useScrollOverflow(C,j.items),v=g.left,P=g.right,x=g.scrollByPage;if(!j.items.length)return null;var A=!!c&&j.items.length>1?a.jsx(u.SortableAttachments,p(p({},j),{},{ref:O,onReorder:c,onItemClick:null!=n?n:h})):a.jsx(t.AttachmentRow,p(p({},j),{},{ref:O,onShare:i,onItemClick:null!=n?n:h}));return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:m.stripShell,children:[A,a.jsx(b,{direction:-1,hiddenCount:v.hiddenCount,onClick:x}),a.jsx(b,{direction:1,hiddenCount:P.hiddenCount,onClick:x})]}),!n&&f]})}));exports.AttachmentPreview=C;
2
2
  //# sourceMappingURL=AttachmentPreview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AttachmentPreview.js","sources":["../../../../src/components/AttachmentPreview/AttachmentPreview.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { useAttachmentLightbox } from '../AttachmentLightbox/useAttachmentLightbox';\n\nimport { AttachmentRow } from './AttachmentRow';\nimport { SortableAttachments } from './SortableAttachments';\nimport { AttachmentPreviewProps } from './AttachmentPreview.types';\n\n/**\n * Picks the strip that fits — reorderable or plain — and gives it a lightbox. Rendering lives in\n * `AttachmentRow`, drag-and-drop in `SortableAttachments`, the modal in `useAttachmentLightbox`.\n */\nexport const AttachmentPreview = forwardRef<HTMLDivElement, AttachmentPreviewProps>(\n ({ onReorder, onItemClick, onShare, ...props }, ref) => {\n const { openAttachment, lightbox } = useAttachmentLightbox(props.items, { onShare });\n\n if (!props.items.length) return null;\n\n const isSortable = !!onReorder && props.items.length > 1;\n const strip = isSortable ? (\n <SortableAttachments\n {...props}\n ref={ref}\n onReorder={onReorder}\n onItemClick={onItemClick ?? openAttachment}\n />\n ) : (\n <AttachmentRow\n {...props}\n ref={ref}\n onShare={onShare}\n onItemClick={onItemClick ?? openAttachment}\n />\n );\n\n return (\n <>\n {strip}\n {!onItemClick && lightbox}\n </>\n );\n }\n);\n"],"names":["AttachmentPreview","forwardRef","_ref","ref","onReorder","onItemClick","onShare","props","_objectWithoutProperties","_excluded","_useAttachmentLightbo","useAttachmentLightbox","items","openAttachment","lightbox","length","strip","_jsx","SortableAttachments","jsx","AttachmentRow","_objectSpread","_jsxs","_Fragment","children"],"mappings":"wjCAYaA,EAAoBC,EAAUA,YACzC,SAAAC,EAAgDC,GAAQ,IAArDC,IAAAA,UAAWC,IAAAA,YAAaC,IAAAA,QAAYC,EAAKC,EAAA,QAAAN,EAAAO,GAC1CC,EAAqCC,EAAAA,sBAAsBJ,EAAMK,MAAO,CAAEN,QAAAA,IAAlEO,IAAAA,eAAgBC,IAAAA,SAExB,IAAKP,EAAMK,MAAMG,OAAQ,OAAO,KAEhC,IACMC,IADeZ,GAAaG,EAAMK,MAAMG,OAAS,EAErDE,EAAAA,IAACC,EAAmBA,2BACdX,GAAK,GAAA,CACTJ,IAAKA,EACLC,UAAWA,EACXC,YAAaA,QAAAA,EAAeQ,KAG9BI,EAAAE,IAACC,gBAAaC,EAAAA,EAAA,CAAA,EACRd,GAAK,GAAA,CACTJ,IAAKA,EACLG,QAASA,EACTD,YAAaA,QAAAA,EAAeQ,KAIhC,OACES,EAAAA,KAAAC,EAAAA,SAAA,CAAAC,SAAA,CACGR,GACCX,GAAeS,IAGvB"}
1
+ {"version":3,"file":"AttachmentPreview.js","sources":["../../../../src/components/AttachmentPreview/AttachmentPreview.tsx"],"sourcesContent":["import { forwardRef, useCallback, useRef } from 'react';\n\nimport { ButtonIcon } from '../../componentsV2/ButtonIcon';\nimport { Tooltip } from '../../componentsV2/Tooltip';\nimport { LeftIcon, RightIcon } from '../../icons';\nimport { useAttachmentLightbox } from '../AttachmentLightbox/useAttachmentLightbox';\n\nimport { AttachmentRow } from './AttachmentRow';\nimport { SortableAttachments } from './SortableAttachments';\nimport { useScrollOverflow } from './useScrollOverflow';\nimport { AttachmentPreviewProps } from './AttachmentPreview.types';\n\nimport styles from './AttachmentPreview.scss';\n\nconst moreLabel = (count: number) =>\n count === 1 ? '1 more attachment' : `${count} more attachments`;\n\ntype ScrollArrowProps = {\n direction: -1 | 1;\n hiddenCount: number;\n onClick: (direction: -1 | 1) => void;\n};\n\nconst ScrollArrow = ({ direction, hiddenCount, onClick }: ScrollArrowProps) => {\n if (!hiddenCount) return null;\n\n const isRight = direction === 1;\n return (\n <Tooltip title={moreLabel(hiddenCount)}>\n <div className={isRight ? styles.scrollArrowRight : styles.scrollArrowLeft}>\n <ButtonIcon\n size=\"xs\"\n type=\"tertiaryBg\"\n ariaLabel={moreLabel(hiddenCount)}\n onClick={() => onClick(direction)}\n testId={isRight ? 'attachment-scroll-right' : 'attachment-scroll-left'}\n >\n {isRight ? <RightIcon size=\"small\" /> : <LeftIcon size=\"small\" />}\n </ButtonIcon>\n </div>\n </Tooltip>\n );\n};\n\n/**\n * Picks the strip that fits — reorderable or plain — and gives it a lightbox. Rendering lives in\n * `AttachmentRow`, drag-and-drop in `SortableAttachments`, the modal in `useAttachmentLightbox`.\n * The strip hides its scrollbar, so overflow arrows are the scroll affordance.\n */\nexport const AttachmentPreview = forwardRef<HTMLDivElement, AttachmentPreviewProps>(\n ({ onReorder, onItemClick, onShare, ...props }, ref) => {\n const { openAttachment, lightbox } = useAttachmentLightbox(props.items, { onShare });\n\n const scrollerRef = useRef<HTMLDivElement | null>(null);\n const setScrollerRef = useCallback(\n (node: HTMLDivElement | null) => {\n scrollerRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n },\n [ref]\n );\n const { left, right, scrollByPage } = useScrollOverflow(scrollerRef, props.items);\n\n if (!props.items.length) return null;\n\n const isSortable = !!onReorder && props.items.length > 1;\n const strip = isSortable ? (\n <SortableAttachments\n {...props}\n ref={setScrollerRef}\n onReorder={onReorder}\n onItemClick={onItemClick ?? openAttachment}\n />\n ) : (\n <AttachmentRow\n {...props}\n ref={setScrollerRef}\n onShare={onShare}\n onItemClick={onItemClick ?? openAttachment}\n />\n );\n\n return (\n <>\n <div className={styles.stripShell}>\n {strip}\n <ScrollArrow direction={-1} hiddenCount={left.hiddenCount} onClick={scrollByPage} />\n <ScrollArrow direction={1} hiddenCount={right.hiddenCount} onClick={scrollByPage} />\n </div>\n {!onItemClick && lightbox}\n </>\n );\n }\n);\n"],"names":["moreLabel","count","concat","ScrollArrow","_ref","direction","hiddenCount","onClick","isRight","_jsx","Tooltip","title","children","jsx","className","styles","scrollArrowRight","scrollArrowLeft","ButtonIcon","size","type","ariaLabel","testId","RightIcon","LeftIcon","AttachmentPreview","forwardRef","_ref2","ref","onReorder","onItemClick","onShare","props","_objectWithoutProperties","_excluded","_useAttachmentLightbo","useAttachmentLightbox","items","openAttachment","lightbox","scrollerRef","useRef","setScrollerRef","useCallback","node","current","_useScrollOverflow","useScrollOverflow","left","right","scrollByPage","length","strip","SortableAttachments","AttachmentRow","_objectSpread","_jsxs","_Fragment","jsxs","stripShell"],"mappings":"8xKAcA,IAAMA,EAAY,SAACC,GAAa,OACpB,IAAVA,EAAc,oBAAmB,GAAAC,OAAMD,EAAwB,oBAAA,EAQ3DE,EAAc,SAA2DC,GAAA,IAAxDC,IAAAA,UAAWC,IAAAA,YAAaC,IAAAA,QAC7C,IAAKD,EAAa,OAAO,KAEzB,IAAME,EAAwB,IAAdH,EAChB,OACEI,EAAAA,IAACC,EAAAA,QAAO,CAACC,MAAOX,EAAUM,GAAaM,SACrCH,EAAAI,IAAA,MAAA,CAAKC,UAAWN,EAAUO,EAAOC,iBAAmBD,EAAOE,gBAAgBL,SACzEH,MAACS,aAAU,CACTC,KAAK,KACLC,KAAK,aACLC,UAAWrB,EAAUM,GACrBC,QAAS,WAAA,OAAMA,EAAQF,EAAW,EAClCiB,OAAQd,EAAU,0BAA4B,yBAAyBI,SAEtEJ,EAAUC,EAAAI,IAACU,YAAS,CAACJ,KAAK,UAAaV,MAACe,WAAQ,CAACL,KAAK,eAKjE,EAOaM,EAAoBC,EAAUA,YACzC,SAAAC,EAAgDC,GAAQ,IAArDC,IAAAA,UAAWC,IAAAA,YAAaC,IAAAA,QAAYC,EAAKC,EAAA,QAAAN,EAAAO,GAC1CC,EAAqCC,EAAAA,sBAAsBJ,EAAMK,MAAO,CAAEN,QAAAA,IAAlEO,IAAAA,eAAgBC,IAAAA,SAElBC,EAAcC,SAA8B,MAC5CC,EAAiBC,eACrB,SAACC,GACCJ,EAAYK,QAAUD,EACH,mBAARhB,EAAoBA,EAAIgB,GAC1BhB,IAAKA,EAAIiB,QAAUD,EAC9B,GACA,CAAChB,IAEHkB,EAAsCC,EAAiBA,kBAACP,EAAaR,EAAMK,OAAnEW,IAAAA,KAAMC,IAAAA,MAAOC,IAAAA,aAErB,IAAKlB,EAAMK,MAAMc,OAAQ,OAAO,KAEhC,IACMC,IADevB,GAAaG,EAAMK,MAAMc,OAAS,EAErD1C,EAAAA,IAAC4C,EAAmBA,2BACdrB,GAAK,GAAA,CACTJ,IAAKc,EACLb,UAAWA,EACXC,YAAaA,QAAAA,EAAeQ,KAG9B7B,EAAAI,IAACyC,gBAAaC,EAAAA,EAAA,CAAA,EACRvB,GAAK,GAAA,CACTJ,IAAKc,EACLX,QAASA,EACTD,YAAaA,QAAAA,EAAeQ,KAIhC,OACEkB,EAAAA,KAAAC,EAAAA,SAAA,CAAA7C,SACE,CAAA4C,EAAAE,KAAA,MAAA,CAAK5C,UAAWC,EAAO4C,WAAW/C,SAC/BwC,CAAAA,EACD3C,EAAAI,IAACV,EAAW,CAACE,WAAY,EAAGC,YAAa0C,EAAK1C,YAAaC,QAAS2C,IACpEzC,MAACN,EAAW,CAACE,UAAW,EAAGC,YAAa2C,EAAM3C,YAAaC,QAAS2C,QAEpEpB,GAAeS,IAGvB"}
@@ -1,2 +1,2 @@
1
- "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')('.AttachmentPreview_scroller__ZqYC8{-ms-overflow-style:none;align-items:flex-start;display:flex;gap:12px;margin-left:-8px;overflow-x:auto;overflow-y:visible;padding-left:8px;padding-right:8px;padding-top:6px;scroll-behavior:smooth;scrollbar-width:none}.AttachmentPreview_scroller__ZqYC8::-webkit-scrollbar{display:none}.AttachmentPreview_slot__ewKLo{border-radius:8px;cursor:grab;flex-shrink:0;position:relative;touch-action:none}.AttachmentPreview_slot__ewKLo:focus-visible{outline:none}.AttachmentPreview_slot__ewKLo:focus-visible:before{border:2px solid var(--palette-primary-main);border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;z-index:5}.AttachmentPreview_slotDragging__hrfJX{cursor:grabbing}.AttachmentPreview_slotDragging__hrfJX .AttachmentPreview_slotContent__GNuSu{visibility:hidden}.AttachmentPreview_slotDragging__hrfJX:focus-visible:before{display:none}.AttachmentPreview_slotDragging__hrfJX:after{background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px dashed var(--palette-primary-text-6);border-radius:8px;content:"";inset:0;position:absolute}.AttachmentPreview_insertion__iFqlp{background:var(--palette-primary-main);border-radius:2px;bottom:0;box-shadow:0 0 6px rgb(from var(--palette-primary-main) r g b/.6);position:absolute;top:0;width:2px;z-index:4}.AttachmentPreview_insertionBefore__jyWQM,.AttachmentPreview_insertionEdge__Bjk1t{left:-7px}.AttachmentPreview_insertionAfter__4NvhP{right:-7px}.AttachmentPreview_dragGhost__4aSzE{background:var(--palette-background-b-6);border-radius:8px;box-shadow:0 10px 20px rgb(from var(--palette-background-b-1) r g b/.45);cursor:grabbing;opacity:.9;position:relative;transform:rotate(4deg)}.AttachmentPreview_dragGhostHandle__Gu2CP{align-items:center;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute;z-index:2}.AttachmentPreview_dragGhostHandle__Gu2CP button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.16)!important;color:var(--palette-primary-text-1)!important}.AttachmentPreview_dragGhostHandle__Gu2CP svg{color:var(--palette-primary-text-1)}.AttachmentPreview_thumbnail__ytI2L{border-radius:8px;flex-shrink:0;height:64px;overflow:visible;position:relative;width:64px}.AttachmentPreview_clickable__BEXzK{cursor:pointer}.AttachmentPreview_clickable__BEXzK:hover{opacity:.9}.AttachmentPreview_selected__JRuMO:after{border:1px solid var(--palette-primary-main);border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;z-index:4}.AttachmentPreview_thumbnailInner__9Ex4-{border-radius:8px;inset:0;overflow:hidden;pointer-events:none;position:absolute}.AttachmentPreview_thumbnailImage__RQ4fL{height:100%;left:50%;max-width:none;min-width:100%;object-fit:cover;pointer-events:none;position:absolute;top:0;transform:translateX(-50%);width:auto}.AttachmentPreview_videoOverlay__5Lgi1{align-items:center;background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute}.AttachmentPreview_playIcon__OOnql{color:var(--palette-primary-text-1);font-size:32px}.AttachmentPreview_fileCard__oxDbD{align-items:flex-start;border:1px solid rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:8px;display:flex;flex-direction:column;flex-shrink:0;height:64px;justify-content:center;padding:8px 16px;position:relative;width:142px}.AttachmentPreview_fileCardLink__TDpvh{color:inherit;cursor:pointer;text-decoration:none}.AttachmentPreview_fileCardLink__TDpvh:hover{border-color:rgb(from var(--palette-primary-text-1) r g b/.16)}.AttachmentPreview_fileCardContent__c-99Q{align-items:center;display:flex;gap:8px;width:100%}.AttachmentPreview_fileInfo__eqJ-B{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;justify-content:center;min-width:0}.AttachmentPreview_fileName__1Ccg0{color:var(--palette-primary-text-1)}.AttachmentPreview_fileName__1Ccg0,.AttachmentPreview_fileType__0v6E4{font-size:14px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.AttachmentPreview_fileType__0v6E4{color:var(--palette-primary-text-6);text-transform:uppercase}.AttachmentPreview_tileActions__2nLlw{display:flex;gap:4px;opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_tileActions__2nLlw button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_tileActions__2nLlw button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD .AttachmentPreview_tileActions__2nLlw:focus-within,.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_tileActions__2nLlw,.AttachmentPreview_thumbnail__ytI2L .AttachmentPreview_tileActions__2nLlw:focus-within,.AttachmentPreview_thumbnail__ytI2L:hover .AttachmentPreview_tileActions__2nLlw{opacity:1}.AttachmentPreview_tileActionLink__aMyS4{display:inline-flex}.AttachmentPreview_removeButton__aX-qu{opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_removeButton__aX-qu button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_removeButton__aX-qu button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_removeButton__aX-qu,.AttachmentPreview_removeButtonVisible__BVjYB,.AttachmentPreview_thumbnail__ytI2L:hover .AttachmentPreview_removeButton__aX-qu{opacity:1}.AttachmentPreview_thumbnailError__yyH08{border:1px solid rgb(from var(--palette-error-main) r g b/.4)}.AttachmentPreview_uploadingOverlay__leV1D{background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_uploadingSpinner__u-t7d{align-items:center;backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:6px;display:flex;height:24px;justify-content:center;position:absolute;right:-6px;top:-6px;width:24px;z-index:2}.AttachmentPreview_loader__HK5bZ{color:var(--palette-primary-text-6)!important;height:14px!important;width:14px!important}.AttachmentPreview_errorOverlay__8sM1d{background:rgb(from var(--palette-error-main) r g b/.08);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_retryButton__tKVV0{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:2}.AttachmentPreview_retryButton__tKVV0 button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_retryButton__tKVV0 button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}'),module.exports={spacing:"8",scroller:"AttachmentPreview_scroller__ZqYC8",slot:"AttachmentPreview_slot__ewKLo",slotDragging:"AttachmentPreview_slotDragging__hrfJX",slotContent:"AttachmentPreview_slotContent__GNuSu",insertion:"AttachmentPreview_insertion__iFqlp",insertionBefore:"AttachmentPreview_insertionBefore__jyWQM",insertionEdge:"AttachmentPreview_insertionEdge__Bjk1t",insertionAfter:"AttachmentPreview_insertionAfter__4NvhP",dragGhost:"AttachmentPreview_dragGhost__4aSzE",dragGhostHandle:"AttachmentPreview_dragGhostHandle__Gu2CP",thumbnail:"AttachmentPreview_thumbnail__ytI2L",clickable:"AttachmentPreview_clickable__BEXzK",selected:"AttachmentPreview_selected__JRuMO",thumbnailInner:"AttachmentPreview_thumbnailInner__9Ex4-",thumbnailImage:"AttachmentPreview_thumbnailImage__RQ4fL",videoOverlay:"AttachmentPreview_videoOverlay__5Lgi1",playIcon:"AttachmentPreview_playIcon__OOnql",fileCard:"AttachmentPreview_fileCard__oxDbD",fileCardLink:"AttachmentPreview_fileCardLink__TDpvh",fileCardContent:"AttachmentPreview_fileCardContent__c-99Q",fileInfo:"AttachmentPreview_fileInfo__eqJ-B",fileName:"AttachmentPreview_fileName__1Ccg0",fileType:"AttachmentPreview_fileType__0v6E4",tileActions:"AttachmentPreview_tileActions__2nLlw",tileActionLink:"AttachmentPreview_tileActionLink__aMyS4",removeButton:"AttachmentPreview_removeButton__aX-qu",removeButtonVisible:"AttachmentPreview_removeButtonVisible__BVjYB",thumbnailError:"AttachmentPreview_thumbnailError__yyH08",uploadingOverlay:"AttachmentPreview_uploadingOverlay__leV1D",uploadingSpinner:"AttachmentPreview_uploadingSpinner__u-t7d",loader:"AttachmentPreview_loader__HK5bZ",errorOverlay:"AttachmentPreview_errorOverlay__8sM1d",retryButton:"AttachmentPreview_retryButton__tKVV0"};
1
+ "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')('.AttachmentPreview_scroller__ZqYC8{-ms-overflow-style:none;align-items:flex-start;display:flex;gap:12px;margin-left:-8px;overflow-x:auto;overflow-y:visible;padding-left:8px;padding-right:8px;padding-top:6px;scroll-behavior:smooth;scrollbar-width:none}.AttachmentPreview_scroller__ZqYC8::-webkit-scrollbar{display:none}.AttachmentPreview_stripShell__ndNiE{max-width:100%;min-width:0;position:relative}.AttachmentPreview_scrollArrowLeft__wpsRM,.AttachmentPreview_scrollArrowRight__aGmVR{pointer-events:auto;position:absolute;top:calc(50% + 3px);transform:translateY(-50%);z-index:6}.AttachmentPreview_scrollArrowLeft__wpsRM button,.AttachmentPreview_scrollArrowRight__aGmVR button{backdrop-filter:blur(8px)}.AttachmentPreview_scrollArrowLeft__wpsRM{left:calc(-12px - var(--attachment-arrow-outset, 0px))}.AttachmentPreview_scrollArrowRight__aGmVR{right:calc(-12px - var(--attachment-arrow-outset, 0px))}@supports not (overflow-clip-margin:12px){.AttachmentPreview_scrollArrowLeft__wpsRM{left:0}.AttachmentPreview_scrollArrowRight__aGmVR{right:0}}.AttachmentPreview_slot__ewKLo{border-radius:8px;cursor:grab;flex-shrink:0;position:relative;touch-action:none}.AttachmentPreview_slot__ewKLo:focus-visible{outline:none}.AttachmentPreview_slot__ewKLo:focus-visible:before{border:2px solid var(--palette-primary-main);border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;z-index:5}.AttachmentPreview_slotDragging__hrfJX{cursor:grabbing}.AttachmentPreview_slotDragging__hrfJX .AttachmentPreview_slotContent__GNuSu{visibility:hidden}.AttachmentPreview_slotDragging__hrfJX:focus-visible:before{display:none}.AttachmentPreview_slotDragging__hrfJX:after{background:rgb(from var(--palette-primary-text-1) r g b/.04);border:1px dashed var(--palette-primary-text-6);border-radius:8px;content:"";inset:0;position:absolute}.AttachmentPreview_insertion__iFqlp{background:var(--palette-primary-main);border-radius:2px;bottom:0;box-shadow:0 0 6px rgb(from var(--palette-primary-main) r g b/.6);position:absolute;top:0;width:2px;z-index:4}.AttachmentPreview_insertionBefore__jyWQM,.AttachmentPreview_insertionEdge__Bjk1t{left:-7px}.AttachmentPreview_insertionAfter__4NvhP{right:-7px}.AttachmentPreview_dragGhost__4aSzE{background:var(--palette-background-b-6);border-radius:8px;box-shadow:0 10px 20px rgb(from var(--palette-background-b-1) r g b/.45);cursor:grabbing;opacity:.9;position:relative;transform:rotate(4deg)}.AttachmentPreview_dragGhostHandle__Gu2CP{align-items:center;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute;z-index:2}.AttachmentPreview_dragGhostHandle__Gu2CP button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.16)!important;color:var(--palette-primary-text-1)!important}.AttachmentPreview_dragGhostHandle__Gu2CP svg{color:var(--palette-primary-text-1)}.AttachmentPreview_thumbnail__ytI2L{border-radius:8px;flex-shrink:0;height:64px;overflow:visible;position:relative;width:64px}.AttachmentPreview_clickable__BEXzK{cursor:pointer}.AttachmentPreview_clickable__BEXzK:hover{opacity:.9}.AttachmentPreview_selected__JRuMO:after{border:1px solid var(--palette-primary-main);border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;z-index:4}.AttachmentPreview_thumbnailInner__9Ex4-{border-radius:8px;inset:0;overflow:hidden;pointer-events:none;position:absolute}.AttachmentPreview_thumbnailImage__RQ4fL{height:100%;left:50%;max-width:none;min-width:100%;object-fit:cover;pointer-events:none;position:absolute;top:0;transform:translateX(-50%);width:auto}.AttachmentPreview_videoOverlay__5Lgi1{align-items:center;background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;display:flex;inset:0;justify-content:center;pointer-events:none;position:absolute}.AttachmentPreview_playIcon__OOnql{color:var(--palette-primary-text-1);font-size:32px}.AttachmentPreview_fileCard__oxDbD{align-items:flex-start;border:1px solid rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:8px;display:flex;flex-direction:column;flex-shrink:0;height:64px;justify-content:center;padding:8px 16px;position:relative;width:142px}.AttachmentPreview_fileCardLink__TDpvh{color:inherit;cursor:pointer;text-decoration:none}.AttachmentPreview_fileCardLink__TDpvh:hover{border-color:rgb(from var(--palette-primary-text-1) r g b/.16)}.AttachmentPreview_fileCardContent__c-99Q{align-items:center;display:flex;gap:8px;width:100%}.AttachmentPreview_fileInfo__eqJ-B{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;justify-content:center;min-width:0}.AttachmentPreview_fileName__1Ccg0{color:var(--palette-primary-text-1)}.AttachmentPreview_fileName__1Ccg0,.AttachmentPreview_fileType__0v6E4{font-size:14px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.AttachmentPreview_fileType__0v6E4{color:var(--palette-primary-text-6);text-transform:uppercase}.AttachmentPreview_tileActions__2nLlw{display:flex;gap:4px;opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_tileActions__2nLlw button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_tileActions__2nLlw button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD .AttachmentPreview_tileActions__2nLlw:focus-within,.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_tileActions__2nLlw,.AttachmentPreview_thumbnail__ytI2L .AttachmentPreview_tileActions__2nLlw:focus-within,.AttachmentPreview_thumbnail__ytI2L:hover .AttachmentPreview_tileActions__2nLlw{opacity:1}.AttachmentPreview_tileActionLink__aMyS4{display:inline-flex}.AttachmentPreview_removeButton__aX-qu{opacity:0;position:absolute;right:-6px;top:-6px;transition:opacity .2s;z-index:3}.AttachmentPreview_removeButton__aX-qu button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_removeButton__aX-qu button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}.AttachmentPreview_fileCard__oxDbD:hover .AttachmentPreview_removeButton__aX-qu,.AttachmentPreview_removeButtonVisible__BVjYB,.AttachmentPreview_thumbnail__ytI2L:hover .AttachmentPreview_removeButton__aX-qu{opacity:1}.AttachmentPreview_thumbnailError__yyH08{border:1px solid rgb(from var(--palette-error-main) r g b/.4)}.AttachmentPreview_uploadingOverlay__leV1D{background:rgb(from var(--palette-background-b-1) r g b/.5);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_uploadingSpinner__u-t7d{align-items:center;backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08);border-radius:6px;display:flex;height:24px;justify-content:center;position:absolute;right:-6px;top:-6px;width:24px;z-index:2}.AttachmentPreview_loader__HK5bZ{color:var(--palette-primary-text-6)!important;height:14px!important;width:14px!important}.AttachmentPreview_errorOverlay__8sM1d{background:rgb(from var(--palette-error-main) r g b/.08);border-radius:8px;inset:0;pointer-events:none;position:absolute}.AttachmentPreview_retryButton__tKVV0{left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);z-index:2}.AttachmentPreview_retryButton__tKVV0 button{backdrop-filter:blur(4px);background-color:rgb(from var(--palette-primary-text-1) r g b/.08)!important}.AttachmentPreview_retryButton__tKVV0 button:hover{background-color:rgb(from var(--palette-primary-text-1) r g b/.15)!important}'),module.exports={spacing:"8",scroller:"AttachmentPreview_scroller__ZqYC8",stripShell:"AttachmentPreview_stripShell__ndNiE",scrollArrowRight:"AttachmentPreview_scrollArrowRight__aGmVR",scrollArrowLeft:"AttachmentPreview_scrollArrowLeft__wpsRM",slot:"AttachmentPreview_slot__ewKLo",slotDragging:"AttachmentPreview_slotDragging__hrfJX",slotContent:"AttachmentPreview_slotContent__GNuSu",insertion:"AttachmentPreview_insertion__iFqlp",insertionBefore:"AttachmentPreview_insertionBefore__jyWQM",insertionEdge:"AttachmentPreview_insertionEdge__Bjk1t",insertionAfter:"AttachmentPreview_insertionAfter__4NvhP",dragGhost:"AttachmentPreview_dragGhost__4aSzE",dragGhostHandle:"AttachmentPreview_dragGhostHandle__Gu2CP",thumbnail:"AttachmentPreview_thumbnail__ytI2L",clickable:"AttachmentPreview_clickable__BEXzK",selected:"AttachmentPreview_selected__JRuMO",thumbnailInner:"AttachmentPreview_thumbnailInner__9Ex4-",thumbnailImage:"AttachmentPreview_thumbnailImage__RQ4fL",videoOverlay:"AttachmentPreview_videoOverlay__5Lgi1",playIcon:"AttachmentPreview_playIcon__OOnql",fileCard:"AttachmentPreview_fileCard__oxDbD",fileCardLink:"AttachmentPreview_fileCardLink__TDpvh",fileCardContent:"AttachmentPreview_fileCardContent__c-99Q",fileInfo:"AttachmentPreview_fileInfo__eqJ-B",fileName:"AttachmentPreview_fileName__1Ccg0",fileType:"AttachmentPreview_fileType__0v6E4",tileActions:"AttachmentPreview_tileActions__2nLlw",tileActionLink:"AttachmentPreview_tileActionLink__aMyS4",removeButton:"AttachmentPreview_removeButton__aX-qu",removeButtonVisible:"AttachmentPreview_removeButtonVisible__BVjYB",thumbnailError:"AttachmentPreview_thumbnailError__yyH08",uploadingOverlay:"AttachmentPreview_uploadingOverlay__leV1D",uploadingSpinner:"AttachmentPreview_uploadingSpinner__u-t7d",loader:"AttachmentPreview_loader__HK5bZ",errorOverlay:"AttachmentPreview_errorOverlay__8sM1d",retryButton:"AttachmentPreview_retryButton__tKVV0"};
2
2
  //# sourceMappingURL=AttachmentPreview.scss.js.map
@@ -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 i=n(e),o=n(r);function u(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?u(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}exports.useScrollOverflow=function(e,r){var n=t.useState({left:{hiddenCount:0},right:{hiddenCount:0}}),i=o.default(n,2),u=i[0],l=i[1],f=t.useCallback((function(){var r=e.current;if(r){var t=function(e){for(var r=e.getBoundingClientRect(),t=0,n=0,i=0,o=Array.from(e.children);i<o.length;i++){var u=o[i].getBoundingClientRect();u.left<r.left-1&&(t+=1),u.right>r.right+1&&(n+=1)}return{left:t,right:n}}(r);l((function(e){return e.left.hiddenCount===t.left&&e.right.hiddenCount===t.right?e:{left:{hiddenCount:t.left},right:{hiddenCount:t.right}}}))}}),[e]);t.useLayoutEffect((function(){f();var r=e.current;if(r){r.addEventListener("scroll",f);var t="undefined"==typeof ResizeObserver?void 0:new ResizeObserver(f);return null==t||t.observe(r),function(){r.removeEventListener("scroll",f),null==t||t.disconnect()}}}),[f,e,r]);var a=t.useCallback((function(r){var t=e.current;if(t){var n=Math.max(t.clientWidth-64,64);t.scrollBy({left:r*n})}}),[e]);return c(c({},u),{},{scrollByPage:a})};
2
+ //# sourceMappingURL=useScrollOverflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useScrollOverflow.js","sources":["../../../../src/components/AttachmentPreview/useScrollOverflow.ts"],"sourcesContent":["import { RefObject, useCallback, useLayoutEffect, useState } from 'react';\n\n// Sub-pixel scroll positions and the strip's edge padding must not count as overflow.\nconst EDGE_TOLERANCE_PX = 1;\n\nexport type OverflowEdge = {\n /** How many tiles are not fully in view past this edge. Zero means no arrow. */\n hiddenCount: number;\n};\n\nexport type ScrollOverflow = {\n left: OverflowEdge;\n right: OverflowEdge;\n scrollByPage: (direction: -1 | 1) => void;\n};\n\nconst countHidden = (scroller: HTMLElement) => {\n const bounds = scroller.getBoundingClientRect();\n let left = 0;\n let right = 0;\n\n for (const tile of Array.from(scroller.children)) {\n const rect = tile.getBoundingClientRect();\n // Not else-if: a tile wider than the viewport can be hidden past both edges at once.\n if (rect.left < bounds.left - EDGE_TOLERANCE_PX) left += 1;\n if (rect.right > bounds.right + EDGE_TOLERANCE_PX) right += 1;\n }\n\n return { left, right };\n};\n\n/**\n * Tracks which attachment tiles are scrolled out of view. The strip hides its scrollbar, so\n * these counts are the only overflow signal the arrows (and their tooltips) have.\n */\nexport const useScrollOverflow = (\n scrollerRef: RefObject<HTMLElement>,\n // The array itself, not its length: a drag-reorder of mixed-width tiles shifts what fits\n // without changing the count or firing a scroll event.\n items: readonly unknown[]\n): ScrollOverflow => {\n const [edges, setEdges] = useState({\n left: { hiddenCount: 0 },\n right: { hiddenCount: 0 },\n });\n\n const update = useCallback(() => {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n\n const counts = countHidden(scroller);\n // Keep the previous state object when nothing changed, or every scroll event re-renders\n // the whole strip.\n setEdges(prev =>\n prev.left.hiddenCount === counts.left && prev.right.hiddenCount === counts.right\n ? prev\n : { left: { hiddenCount: counts.left }, right: { hiddenCount: counts.right } }\n );\n }, [scrollerRef]);\n\n // Layout effect so a strip that mounts already overflowing shows its arrow on first paint.\n useLayoutEffect(() => {\n update();\n\n const scroller = scrollerRef.current;\n if (!scroller) return undefined;\n\n scroller.addEventListener('scroll', update);\n // Guarded: jsdom has no ResizeObserver.\n const observer = typeof ResizeObserver === 'undefined' ? undefined : new ResizeObserver(update);\n observer?.observe(scroller);\n\n return () => {\n scroller.removeEventListener('scroll', update);\n observer?.disconnect();\n };\n }, [update, scrollerRef, items]);\n\n const scrollByPage = useCallback(\n (direction: -1 | 1) => {\n const scroller = scrollerRef.current;\n if (!scroller) return;\n\n // Almost a full viewport, so one tile carries over as the reader's anchor. Smoothness\n // comes from the scroller's own scroll-behavior.\n const page = Math.max(scroller.clientWidth - 64, 64);\n scroller.scrollBy({ left: direction * page });\n },\n [scrollerRef]\n );\n\n return { ...edges, scrollByPage };\n};\n"],"names":["scrollerRef","items","_useState","useState","left","hiddenCount","right","_useState2","_slicedToArray","edges","setEdges","update","useCallback","scroller","current","counts","bounds","getBoundingClientRect","Array","from","children","_i","_Array$from","length","rect","countHidden","prev","useLayoutEffect","addEventListener","observer","ResizeObserver","undefined","observe","removeEventListener","disconnect","scrollByPage","direction","page","Math","max","clientWidth","scrollBy","_objectSpread"],"mappings":"23BAmCiC,SAC/BA,EAGAC,GAEA,IAAAC,EAA0BC,EAAAA,SAAS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1B,EAAS2B,YAAc,GAAI,IACjD3B,EAAS4B,SAAS,CAAErC,KAAMgC,EAAYC,GALvB,CAMjB,GACA,CAACrC,IAGH,OAAA0C,EAAAA,EAAA,CAAA,EAAYjC,GAAK,CAAA,EAAA,CAAE0B,aAAAA,GACrB"}
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/assertThisInitialized"),i=require("@babel/runtime/helpers/inherits"),a=require("@babel/runtime/helpers/possibleConstructorReturn"),o=require("@babel/runtime/helpers/getPrototypeOf"),s=require("@babel/runtime/helpers/defineProperty"),l=require("@babel/runtime/regenerator"),u=require("react"),c=require("prop-types"),d=require("moment"),m=require("lodash"),p=require("classnames"),h=require("@material-ui/core/styles"),f=require("@material-ui/core/Typography"),v=require("@material-ui/core/Menu"),y=require("@material-ui/core/MenuItem"),g=require("@material-ui/icons/MoreVert"),b=require("../../clients/jsonApi/index.js"),C=require("./styles.css.js"),j=require("../CommentWrapper.js"),x=require("../CommentLoader.js"),M=require("../CommentInput/index.js"),q=require("../Avatar/index.js"),D=require("../Attachment/index.js"),w=require("../IconButton/index.js"),E=require("../ConfirmationDialog.js"),O=require("../UserCardPopover.js"),I=require("../UserMention/utils/index.js"),A=require("../../utils/mobileDetect.js"),k=require("../../utils/main.js"),N=require("react/jsx-runtime");function _(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var S=_(e),R=_(t),P=_(n),U=_(r),z=_(i),L=_(a),T=_(o),W=_(s),B=_(l),F=_(c),H=_(d),V=_(p),K=_(f),Y=_(v),G=_(y),J=_(g);function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function X(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=T.default(e);if(t){var i=T.default(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return L.default(this,n)}}var Z={chatAvatarWrapper:{paddingTop:2,position:"absolute",top:6,left:0},commentInfoContainer:{display:"inline-flex",alignItems:"center",width:"100%",paddingTop:5},userNameWrapper:{overflow:"hidden"},infoContainer:{display:"inline-block",verticalAlign:"top",width:"100%",paddingLeft:33}},$=function(e){z.default(n,e);var t=X(n);function n(e){var r,i;return R.default(this,n),r=t.call(this,e),W.default(U.default(r),"deleteComment",(i=S.default(B.default.mark((function e(t,n){var r;return B.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,b.deleteFeedItemComment(t,n);case 3:r=e.sent,e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),console.error(e.t0);case 9:return e.abrupt("return",r);case 10:case"end":return e.stop()}}),e,null,[[0,6]])}))),function(e,t){return i.apply(this,arguments)})),W.default(U.default(r),"showIntoView",(function(){r.props.handleShowOnMount(),r.commentEl.current.scrollIntoView({block:"end"})})),W.default(U.default(r),"handleOpenActionsMenu",(function(e){e.stopPropagation(),r.setState({actionsMenuAnchorEl:e.currentTarget})})),W.default(U.default(r),"handleCloseActionsMenu",(function(e){e.stopPropagation(),r.setState({actionsMenuAnchorEl:null})})),W.default(U.default(r),"handleKeyDown",(function(e){27===e.keyCode&&r.setState({isEditing:!1}),document.removeEventListener("keydown",r.handleKeyDown,!1)})),W.default(U.default(r),"handleEditMenuItem",(function(){document.addEventListener("keydown",r.handleKeyDown,!1),r.setState({isEditing:!0},(function(){r.inputEl.current&&r.inputEl.current.focus()}))})),W.default(U.default(r),"getEditCommentProps",(function(){var e=r.props.comment,t=e.id,n=e.body,i=e.attachment;return{editFeedItemId:e.feed_activity_id,editCommentId:t,editComment:n,editAttachment:i}})),W.default(U.default(r),"onEditFinish",(function(){r.setState({isEditing:!1,isLoading:!1})})),W.default(U.default(r),"handleDeleteMenuItem",(function(){r.setState({openDeleteDialog:!0})})),W.default(U.default(r),"handleDelete",S.default(B.default.mark((function e(){var t,n,i;return B.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.props.comment.id,n=r.props.comment.feed_activity_id,r.setState({isLoading:!0}),e.next=5,r.deleteComment(n,t);case 5:i=e.sent,r.setState({isLoading:!1,openDeleteDialog:!1}),i&&r.props.handleDeleteCallback(t);case 8:case"end":return e.stop()}}),e)})))),r.state={actionsMenuAnchorEl:null,isLoading:!1,isEditing:!1,openDeleteDialog:!1},r.inputEl=u.createRef(),r.commentEl=u.createRef(),r}return P.default(n,[{key:"componentDidMount",value:function(){this.props.showOnMount&&this.showIntoView()}},{key:"isCurrentUserCommentCreator",get:function(){return Number(m.get(this.props.comment,["user","id"]))===Number(this.props.currentUser.id)}},{key:"renderMenuIcon",value:function(){var e=this.isCurrentUserCommentCreator,t=this.isCurrentUserCommentCreator||m.includes(this.props.comment.allowed_actions,"destroy");return t||e?N.jsxs("div",{className:C.cCommentMenu,children:[N.jsx(w,{"data-testid":"".concat("comment","_menuButton"),"aria-label":"Actions","aria-owns":this.state.actionsMenuAnchorEl?"c-comment__actions-menu":void 0,"aria-haspopup":"true",className:this.props.classes.iconButtonRoot,size:"small",onClick:this.handleOpenActionsMenu,children:N.jsx(J.default,{})}),N.jsxs(Y.default,{id:"c-comment__actions-menu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:this.state.actionsMenuAnchorEl,open:!!this.state.actionsMenuAnchorEl,onClick:this.handleCloseActionsMenu,onClose:this.handleCloseActionsMenu,children:[e&&N.jsx(G.default,{"data-testid":"".concat("comment","_editMenuItem"),onClick:this.handleEditMenuItem,children:"Edit"}),t&&N.jsx(G.default,{"data-testid":"".concat("comment","_deleteMenuItem"),onClick:this.handleDeleteMenuItem,children:"Delete"})]})]}):null}},{key:"render",value:function(){var e,t,n=this,r=this.state,i=r.isLoading,a=r.isEditing;if(i){var o=this.props.spaceAround;return N.jsx(x,{spaceAround:o})}var s=this.props,l=s.comment,u=s.classes,c=s.spaceAround,d=s.isNative,p=s.patchCommentCallback,h=s.companyId;if(a)return N.jsx(M,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(n),!0).forEach((function(t){W.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({inputRef:this.inputEl,postComment:m.noop,exitEditMode:this.onEditFinish,setIsEditting:function(){return n.setState({isLoading:!0})},patchCommentCallback:p,companyId:h,currentUser:this.props.currentUser},this.getEditCommentProps()));var f=k.default.getUserFullName(l.user),v=d?"MM/DD HH:mm":"MM/DD/YY HH:mm",y=H.default(l.created_at).format(v),g=(null==l||null===(e=l.attachment)||void 0===e?void 0:e.signed_url)||(null==l||null===(t=l.attachment)||void 0===t?void 0:t.url),b=m.get(l,["attachment","size"]),w=m.get(l,["attachment","file_name"]);return N.jsxs("div",{"data-testid":"".concat("comment","_commentItem_").concat(l.body),className:V.default(C.cComment,W.default({},C.cCommentNative,d)),ref:this.commentEl,children:[N.jsxs(j,{spaceAround:c,className:this.props.classes.commentWrapper,children:[N.jsx("div",{style:Z.chatAvatarWrapper,children:d?N.jsx(q.AvatarComponent,{size:24,displayName:f,imgSrc:m.get(l,["user","profile_photo"]),className:this.props.classes.avatar}):N.jsx(O,{user:l.user,currentUser:this.props.currentUser,children:N.jsx(q.AvatarComponent,{size:24,displayName:f,imgSrc:m.get(l,["user","profile_photo"]),className:this.props.classes.avatar})})}),N.jsxs("div",{style:Z.infoContainer,children:[N.jsx("div",{children:N.jsxs("div",{style:Z.commentInfoContainer,children:[N.jsx("div",{style:Z.userNameWrapper,children:N.jsx(K.default,{"data-testid":"".concat("comment","_userName"),variant:"subtitle2",noWrap:!0,className:u.userName,children:f})}),N.jsx("div",{style:Z.timeWrapper,children:N.jsx(K.default,{"data-testid":"".concat("comment","_addTime"),variant:"caption",classes:{root:u.timeRoot},children:y})})]})}),N.jsxs("div",{className:C.cCommentBody,children:[this.renderMenuIcon(),N.jsx(K.default,{"data-testid":"".concat("comment","_commentMessage"),variant:"body1",classes:{root:u.textRoot},children:I.formatMentionText(l.body,l.mentioned_users,d,"#00bcd4",this.props.currentUser)}),g&&N.jsx(D,{attachmentUrl:g,attachmentSize:b,size:"small",fileName:w})]})]})]}),this.state.openDeleteDialog&&N.jsx(E,{open:this.state.openDeleteDialog,text:"Do you really want to delete comment?",handleClose:function(){return n.setState({openDeleteDialog:!1})},handleOk:this.handleDelete,okText:"Delete"})]})}}]),n}(u.PureComponent);$.propTypes={comment:F.default.shape({}).isRequired,showOnMount:F.default.bool,spaceAround:F.default.bool,handleShowOnMount:F.default.func,handleEdit:F.default.func,handleDeleteCallback:F.default.func.isRequired,patchCommentCallback:F.default.func.isRequired,companyId:F.default.number,currentUser:F.default.shape(),classes:F.default.shape({}).isRequired,isNative:F.default.bool},$.defaultProps={showOnMount:!1,spaceAround:!1,handleShowOnMount:m.noop,handleEdit:m.noop,companyId:null,isNative:A.isNativeDetected,currentUser:{}};var ee=h.withStyles((function(e){return{commentWrapper:{width:"100%"},timeRoot:{color:e.palette.primary.text7,float:"right",marginRight:5,marginLeft:8,fontSize:"12px"},textRoot:{marginTop:5,color:"#CCC",fontWeight:"normal",fontSize:"14px"},iconButtonRoot:{float:"right",visibility:"hidden",color:e.palette.primary.text7},userName:{fontSize:"12px",fontWeight:"bold"}}}))($);module.exports=ee;
1
+ "use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("react"),a=require("prop-types"),n=require("moment"),i=require("lodash"),o=require("classnames"),r=require("@material-ui/core/styles"),l=require("@material-ui/core/Typography"),s=require("@material-ui/core/Menu"),d=require("@material-ui/core/MenuItem"),c=require("@material-ui/icons/MoreVert"),m=require("./useComment.js"),u=require("./styles.css.js"),p=require("../CommentWrapper.js"),h=require("../CommentLoader.js"),f=require("../CommentInput/index.js"),v=require("../Avatar/index.js"),x=require("../Attachment/index.js"),j=require("../IconButton/index.js"),C=require("../ConfirmationDialog.js"),g=require("../UserCardPopover.js"),y=require("../UserMention/utils/index.js"),q=require("../../utils/mobileDetect.js"),b=require("../../utils/main.js"),M=require("react/jsx-runtime");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=N(e),D=N(a),I=N(n),A=N(o),w=N(l),k=N(s),E=N(d),R=N(c),z={chatAvatarWrapper:{paddingTop:2,position:"absolute",top:6,left:0},commentInfoContainer:{display:"inline-flex",alignItems:"center",width:"100%",paddingTop:5},userNameWrapper:{overflow:"hidden"},infoContainer:{display:"inline-block",verticalAlign:"top",width:"100%",paddingLeft:33}},W={};function O(e){var t,a,n=e.comment,o=e.showOnMount,r=void 0!==o&&o,l=e.spaceAround,s=void 0!==l&&l,d=e.handleShowOnMount,c=void 0===d?i.noop:d,N=e.handleDeleteCallback,D=e.patchCommentCallback,O=e.companyId,S=void 0===O?null:O,T=e.currentUser,U=void 0===T?W:T,B=e.classes,H=e.isNative,L=void 0===H?q.isNativeDetected:H,F=m({comment:n,showOnMount:r,handleShowOnMount:c,handleDeleteCallback:N}),P=F.actionsMenuAnchorEl,Y=F.isLoading,V=F.isEditing,G=F.openDeleteDialog,J=F.inputEl,K=F.commentEl,Q=F.handleOpenActionsMenu,X=F.handleCloseActionsMenu,Z=F.handleEditMenuItem,$=F.onEditFinish,ee=F.setIsEditting,te=F.handleDeleteMenuItem,ae=F.handleCloseDeleteDialog,ne=F.handleDelete,ie=Number(i.get(n,["user","id"]))===Number(U.id);if(Y)return M.jsx(h,{spaceAround:s});if(V)return M.jsx(f,{inputRef:J,postComment:i.noop,exitEditMode:$,setIsEditting:ee,patchCommentCallback:D,companyId:S,currentUser:U,editFeedItemId:n.feed_activity_id,editCommentId:n.id,editComment:n.body,editAttachment:n.attachment});var oe,re,le=b.default.getUserFullName(n.user),se=L?"MM/DD HH:mm":"MM/DD/YY HH:mm",de=I.default(n.created_at).format(se),ce=(null==n||null===(t=n.attachment)||void 0===t?void 0:t.signed_url)||(null==n||null===(a=n.attachment)||void 0===a?void 0:a.url),me=i.get(n,["attachment","size"]),ue=i.get(n,["attachment","file_name"]);return M.jsxs("div",{"data-testid":"".concat("comment","_commentItem_").concat(n.body),className:A.default(u.cComment,_.default({},u.cCommentNative,L)),ref:K,children:[M.jsxs(p,{spaceAround:s,className:B.commentWrapper,children:[M.jsx("div",{style:z.chatAvatarWrapper,children:L?M.jsx(v.AvatarComponent,{size:24,displayName:le,imgSrc:i.get(n,["user","profile_photo"]),className:B.avatar}):M.jsx(g,{user:n.user,currentUser:U,children:M.jsx(v.AvatarComponent,{size:24,displayName:le,imgSrc:i.get(n,["user","profile_photo"]),className:B.avatar})})}),M.jsxs("div",{style:z.infoContainer,children:[M.jsx("div",{children:M.jsxs("div",{style:z.commentInfoContainer,children:[M.jsx("div",{style:z.userNameWrapper,children:M.jsx(w.default,{"data-testid":"".concat("comment","_userName"),variant:"subtitle2",noWrap:!0,className:B.userName,children:le})}),M.jsx("div",{style:z.timeWrapper,children:M.jsx(w.default,{"data-testid":"".concat("comment","_addTime"),variant:"caption",classes:{root:B.timeRoot},children:de})})]})}),M.jsxs("div",{className:u.cCommentBody,children:[(oe=ie,re=ie||i.includes(n.allowed_actions,"destroy"),re||oe?M.jsxs("div",{className:u.cCommentMenu,children:[M.jsx(j,{"data-testid":"".concat("comment","_menuButton"),"aria-label":"Actions","aria-owns":P?"c-comment__actions-menu":void 0,"aria-haspopup":"true",className:B.iconButtonRoot,size:"small",onClick:Q,children:M.jsx(R.default,{})}),M.jsxs(k.default,{id:"c-comment__actions-menu",anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:P,open:!!P,onClick:X,onClose:X,children:[oe&&M.jsx(E.default,{"data-testid":"".concat("comment","_editMenuItem"),onClick:Z,children:"Edit"}),re&&M.jsx(E.default,{"data-testid":"".concat("comment","_deleteMenuItem"),onClick:te,children:"Delete"})]})]}):null),M.jsx(w.default,{"data-testid":"".concat("comment","_commentMessage"),variant:"body1",classes:{root:B.textRoot},children:y.formatMentionText(n.body,n.mentioned_users,L,"#00bcd4",U)}),ce&&M.jsx(x,{attachmentUrl:ce,attachmentSize:me,size:"small",fileName:ue})]})]})]}),G&&M.jsx(C,{open:G,text:"Do you really want to delete comment?",handleClose:ae,handleOk:ne,okText:"Delete"})]})}O.propTypes={comment:D.default.shape({}).isRequired,showOnMount:D.default.bool,spaceAround:D.default.bool,handleShowOnMount:D.default.func,handleEdit:D.default.func,handleDeleteCallback:D.default.func.isRequired,patchCommentCallback:D.default.func.isRequired,companyId:D.default.number,currentUser:D.default.shape(),classes:D.default.shape({}).isRequired,isNative:D.default.bool};var S=r.withStyles((function(e){return{commentWrapper:{width:"100%"},timeRoot:{color:e.palette.primary.text7,float:"right",marginRight:5,marginLeft:8,fontSize:"12px"},textRoot:{marginTop:5,color:"#CCC",fontWeight:"normal",fontSize:"14px"},iconButtonRoot:{float:"right",visibility:"hidden",color:e.palette.primary.text7},userName:{fontSize:"12px",fontWeight:"bold"}}}))(t.memo(O));module.exports=S;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Comment/index.js"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport { createRef, PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport { get, noop, includes } from 'lodash';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\n\nimport { deleteFeedItemComment } from '../../clients/jsonApi';\n\nimport styles from './styles.css';\n\nimport CommentWrapper from '~components/CommentWrapper';\nimport CommentLoader from '~components/CommentLoader';\nimport CommentInput from '~components/CommentInput';\nimport Avatar from '~components/Avatar';\nimport Attachment from '~components/Attachment';\nimport IconButton from '~components/IconButton';\nimport ConfirmationDialog from '~components/ConfirmationDialog';\nimport UserCardPopover from '~components/UserCardPopover';\nimport { formatMentionText } from '~components/UserMention/utils';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport utils from '~utils/main';\n\nconst PAGE_NAME = 'comment';\n\nconst CREATED_AT_FORMAT = 'MM/DD/YY HH:mm';\nconst CREATED_AT_FORMAT_NATIVE = 'MM/DD HH:mm';\n\nconst style = {\n chatAvatarWrapper: {\n paddingTop: 2,\n position: 'absolute',\n top: 6,\n left: 0,\n },\n commentInfoContainer: {\n display: 'inline-flex',\n alignItems: 'center',\n width: '100%',\n paddingTop: 5,\n },\n userNameWrapper: { overflow: 'hidden' },\n infoContainer: {\n display: 'inline-block',\n verticalAlign: 'top',\n width: '100%',\n paddingLeft: 33,\n },\n};\n\nconst muiStyles = theme => ({\n commentWrapper: { width: '100%' },\n timeRoot: {\n color: theme.palette.primary.text7,\n float: 'right',\n marginRight: 5,\n marginLeft: 8,\n fontSize: '12px',\n },\n textRoot: {\n marginTop: 5,\n color: '#CCC',\n fontWeight: 'normal',\n fontSize: '14px',\n },\n iconButtonRoot: {\n float: 'right',\n visibility: 'hidden',\n color: theme.palette.primary.text7,\n },\n userName: {\n fontSize: '12px',\n fontWeight: 'bold',\n },\n});\n\nclass Comment extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n actionsMenuAnchorEl: null,\n isLoading: false,\n isEditing: false,\n openDeleteDialog: false,\n };\n this.inputEl = createRef();\n this.commentEl = createRef();\n }\n\n componentDidMount() {\n if (this.props.showOnMount) {\n this.showIntoView();\n }\n }\n\n get isCurrentUserCommentCreator() {\n return Number(get(this.props.comment, ['user', 'id'])) === Number(this.props.currentUser.id);\n }\n\n deleteComment = async (feedItemId, commentId) => {\n let commentResponse;\n\n try {\n commentResponse = await deleteFeedItemComment(feedItemId, commentId);\n } catch (e) {\n console.error(e);\n }\n\n return commentResponse;\n };\n\n showIntoView = () => {\n this.props.handleShowOnMount();\n this.commentEl.current.scrollIntoView({ block: 'end' });\n };\n\n handleOpenActionsMenu = event => {\n event.stopPropagation();\n this.setState({ actionsMenuAnchorEl: event.currentTarget });\n };\n\n handleCloseActionsMenu = event => {\n event.stopPropagation();\n this.setState({ actionsMenuAnchorEl: null });\n };\n\n handleKeyDown = event => {\n if (event.keyCode === 27) {\n this.setState({\n isEditing: false,\n });\n }\n document.removeEventListener('keydown', this.handleKeyDown, false);\n };\n\n handleEditMenuItem = () => {\n document.addEventListener('keydown', this.handleKeyDown, false);\n this.setState(\n {\n isEditing: true,\n },\n () => {\n if (this.inputEl.current) this.inputEl.current.focus();\n }\n );\n };\n\n // TODO: move to one prop, not multiple\n getEditCommentProps = () => {\n const { comment } = this.props;\n const editCommentId = comment.id;\n const editComment = comment.body;\n const editAttachment = comment.attachment;\n const editFeedItemId = comment.feed_activity_id;\n return {\n editFeedItemId,\n editCommentId,\n editComment,\n editAttachment,\n };\n };\n\n onEditFinish = () => {\n this.setState({ isEditing: false, isLoading: false });\n };\n\n handleDeleteMenuItem = () => {\n this.setState({ openDeleteDialog: true });\n };\n\n handleDelete = async () => {\n const { id } = this.props.comment;\n const feedItemId = this.props.comment.feed_activity_id;\n\n this.setState({ isLoading: true });\n\n const response = await this.deleteComment(feedItemId, id);\n\n this.setState({ isLoading: false, openDeleteDialog: false });\n if (response) this.props.handleDeleteCallback(id);\n };\n\n renderMenuIcon() {\n const showEdit = this.isCurrentUserCommentCreator;\n\n const showDelete =\n this.isCurrentUserCommentCreator || includes(this.props.comment.allowed_actions, 'destroy');\n\n if (!(showDelete || showEdit)) return null;\n\n return (\n <div className={styles.cCommentMenu}>\n <IconButton\n data-testid={`${PAGE_NAME}_menuButton`}\n aria-label=\"Actions\"\n aria-owns={this.state.actionsMenuAnchorEl ? 'c-comment__actions-menu' : undefined}\n aria-haspopup=\"true\"\n className={this.props.classes.iconButtonRoot}\n size=\"small\"\n onClick={this.handleOpenActionsMenu}\n >\n <MoreVertIcon />\n </IconButton>\n\n <Menu\n id=\"c-comment__actions-menu\"\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n anchorEl={this.state.actionsMenuAnchorEl}\n open={!!this.state.actionsMenuAnchorEl}\n onClick={this.handleCloseActionsMenu}\n onClose={this.handleCloseActionsMenu}\n >\n {showEdit && (\n <MenuItem data-testid={`${PAGE_NAME}_editMenuItem`} onClick={this.handleEditMenuItem}>\n Edit\n </MenuItem>\n )}\n\n {showDelete && (\n <MenuItem\n data-testid={`${PAGE_NAME}_deleteMenuItem`}\n onClick={this.handleDeleteMenuItem}\n >\n Delete\n </MenuItem>\n )}\n </Menu>\n </div>\n );\n }\n\n render() {\n const { isLoading, isEditing } = this.state;\n\n if (isLoading) {\n const { spaceAround } = this.props;\n return <CommentLoader spaceAround={spaceAround} />;\n }\n\n const { comment, classes, spaceAround, isNative, patchCommentCallback, companyId } = this.props;\n\n if (isEditing) {\n return (\n <CommentInput\n inputRef={this.inputEl}\n postComment={noop}\n exitEditMode={this.onEditFinish}\n setIsEditting={() => this.setState({ isLoading: true })}\n patchCommentCallback={patchCommentCallback}\n companyId={companyId}\n currentUser={this.props.currentUser}\n {...this.getEditCommentProps()}\n />\n );\n }\n\n const userFullName = utils.getUserFullName(comment.user);\n\n const format = isNative ? CREATED_AT_FORMAT_NATIVE : CREATED_AT_FORMAT;\n const time = moment(comment.created_at).format(format);\n\n const attachmentUrl = comment?.attachment?.signed_url || comment?.attachment?.url;\n const attachmentSize = get(comment, ['attachment', 'size']);\n const attachmentFileName = get(comment, ['attachment', 'file_name']);\n\n return (\n <div\n data-testid={`${PAGE_NAME}_commentItem_${comment.body}`}\n className={classNames(styles.cComment, { [styles.cCommentNative]: isNative })}\n ref={this.commentEl}\n >\n <CommentWrapper spaceAround={spaceAround} className={this.props.classes.commentWrapper}>\n <div style={style.chatAvatarWrapper}>\n {isNative ? (\n <Avatar\n size={24}\n displayName={userFullName}\n imgSrc={get(comment, ['user', 'profile_photo'])}\n className={this.props.classes.avatar}\n />\n ) : (\n <UserCardPopover user={comment.user} currentUser={this.props.currentUser}>\n <Avatar\n size={24}\n displayName={userFullName}\n imgSrc={get(comment, ['user', 'profile_photo'])}\n className={this.props.classes.avatar}\n />\n </UserCardPopover>\n )}\n </div>\n\n <div style={style.infoContainer}>\n <div>\n <div style={style.commentInfoContainer}>\n <div style={style.userNameWrapper}>\n <Typography\n data-testid={`${PAGE_NAME}_userName`}\n variant=\"subtitle2\"\n noWrap\n className={classes.userName}\n >\n {userFullName}\n </Typography>\n </div>\n\n <div style={style.timeWrapper}>\n <Typography\n data-testid={`${PAGE_NAME}_addTime`}\n variant=\"caption\"\n classes={{ root: classes.timeRoot }}\n >\n {time}\n </Typography>\n </div>\n </div>\n </div>\n\n <div className={styles.cCommentBody}>\n {this.renderMenuIcon()}\n <Typography\n data-testid={`${PAGE_NAME}_commentMessage`}\n variant=\"body1\"\n classes={{ root: classes.textRoot }}\n >\n {formatMentionText(\n comment.body,\n comment.mentioned_users,\n isNative,\n '#00bcd4',\n this.props.currentUser\n )}\n </Typography>\n\n {attachmentUrl && (\n <Attachment\n attachmentUrl={attachmentUrl}\n attachmentSize={attachmentSize}\n size=\"small\"\n fileName={attachmentFileName}\n />\n )}\n </div>\n </div>\n </CommentWrapper>\n\n {this.state.openDeleteDialog && (\n <ConfirmationDialog\n open={this.state.openDeleteDialog}\n text=\"Do you really want to delete comment?\"\n handleClose={() => this.setState({ openDeleteDialog: false })}\n handleOk={this.handleDelete}\n okText=\"Delete\"\n />\n )}\n </div>\n );\n }\n}\n\nComment.propTypes = {\n comment: PropTypes.shape({}).isRequired,\n showOnMount: PropTypes.bool,\n spaceAround: PropTypes.bool,\n handleShowOnMount: PropTypes.func,\n handleEdit: PropTypes.func,\n handleDeleteCallback: PropTypes.func.isRequired,\n patchCommentCallback: PropTypes.func.isRequired,\n companyId: PropTypes.number,\n currentUser: PropTypes.shape(),\n\n classes: PropTypes.shape({}).isRequired,\n isNative: PropTypes.bool,\n};\n\nComment.defaultProps = {\n showOnMount: false,\n spaceAround: false,\n handleShowOnMount: noop,\n handleEdit: noop,\n companyId: null,\n\n isNative: isNativeDetected,\n\n currentUser: {},\n};\n\nexport default withStyles(muiStyles)(Comment);\n"],"names":["style","chatAvatarWrapper","paddingTop","position","top","left","commentInfoContainer","display","alignItems","width","userNameWrapper","overflow","infoContainer","verticalAlign","paddingLeft","Comment","_PureComponent","_inherits","_super","_createSuper","props","_this","_ref","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","_asyncToGenerator","_regeneratorRuntime","mark","_callee","feedItemId","commentId","commentResponse","wrap","_context","prev","next","deleteFeedItemComment","sent","t0","console","error","abrupt","stop","_x","_x2","apply","arguments","handleShowOnMount","commentEl","current","scrollIntoView","block","event","stopPropagation","setState","actionsMenuAnchorEl","currentTarget","keyCode","isEditing","document","removeEventListener","handleKeyDown","addEventListener","inputEl","focus","comment","editCommentId","id","editComment","body","editAttachment","attachment","editFeedItemId","feed_activity_id","isLoading","openDeleteDialog","_callee2","response","_context2","deleteComment","handleDeleteCallback","state","createRef","_createClass","key","value","showOnMount","showIntoView","get","Number","currentUser","showEdit","isCurrentUserCommentCreator","showDelete","includes","allowed_actions","_jsxs","className","styles","cCommentMenu","children","_jsx","IconButton","concat","undefined","classes","iconButtonRoot","size","onClick","handleOpenActionsMenu","MoreVertIcon","Menu","anchorOrigin","vertical","horizontal","transformOrigin","anchorEl","open","handleCloseActionsMenu","onClose","jsx","MenuItem","handleEditMenuItem","handleDeleteMenuItem","_comment$attachment","_comment$attachment2","_this2","_this$state","spaceAround","CommentLoader","_this$props","isNative","patchCommentCallback","companyId","CommentInput","_objectSpread","inputRef","postComment","noop","exitEditMode","onEditFinish","setIsEditting","getEditCommentProps","userFullName","utils","getUserFullName","user","format","time","moment","created_at","attachmentUrl","signed_url","url","attachmentSize","attachmentFileName","classNames","cComment","cCommentNative","ref","CommentWrapper","commentWrapper","Avatar","displayName","imgSrc","avatar","UserCardPopover","jsxs","Typography","variant","noWrap","userName","timeWrapper","root","timeRoot","cCommentBody","renderMenuIcon","textRoot","formatMentionText","mentioned_users","Attachment","fileName","ConfirmationDialog","text","handleClose","handleOk","handleDelete","okText","PureComponent","propTypes","PropTypes","shape","isRequired","bool","func","handleEdit","number","defaultProps","isNativeDetected","Comment$1","withStyles","theme","color","palette","primary","text7","float","marginRight","marginLeft","fontSize","marginTop","fontWeight","visibility"],"mappings":"4lEA4BA,IAKMA,EAAQ,CACZC,kBAAmB,CACjBC,WAAY,EACZC,SAAU,WACVC,IAAK,EACLC,KAAM,GAERC,qBAAsB,CACpBC,QAAS,cACTC,WAAY,SACZC,MAAO,OACPP,WAAY,GAEdQ,gBAAiB,CAAEC,SAAU,UAC7BC,cAAe,CACbL,QAAS,eACTM,cAAe,MACfJ,MAAO,OACPK,YAAa,KA8BXC,EAAO,SAAAC,GAAAC,UAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GACX,SAAAA,EAAYK,GAAO,IAAAC,EAuBHC,EAbe,OAVZC,UAAAC,KAAAT,GACjBM,EAAAH,EAAAO,KAAAD,KAAMJ,GAAOM,EAAAA,QAAAC,EAAA,QAAAN,GAAA,iBAsBCC,EAAAM,EAAAA,QAAAC,EAAA,QAAAC,MAAA,SAAAC,EAAOC,EAAYC,GAAS,IAAAC,EAAA,OAAAL,UAAAM,MAAA,SAAAC,GAAA,OAAA,OAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAAA,OAAAF,EAAAC,KAAA,EAAAD,EAAAE,KAAA,EAIhBC,EAAqBA,sBAACP,EAAYC,GAAU,KAAA,EAApEC,EAAeE,EAAAI,KAAAJ,EAAAE,KAAA,EAAA,MAAA,KAAA,EAAAF,EA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js","sources":["../../../../src/components/Comment/index.js"],"sourcesContent":["/* eslint-disable react/prop-types */\nimport { memo } from 'react';\nimport PropTypes from 'prop-types';\nimport moment from 'moment';\nimport { get, noop, includes } from 'lodash';\nimport classNames from 'classnames';\nimport { withStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport Menu from '@material-ui/core/Menu';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport MoreVertIcon from '@material-ui/icons/MoreVert';\n\nimport useComment from './useComment';\n\nimport styles from './styles.css';\n\nimport CommentWrapper from '~components/CommentWrapper';\nimport CommentLoader from '~components/CommentLoader';\nimport CommentInput from '~components/CommentInput';\nimport Avatar from '~components/Avatar';\nimport Attachment from '~components/Attachment';\nimport IconButton from '~components/IconButton';\nimport ConfirmationDialog from '~components/ConfirmationDialog';\nimport UserCardPopover from '~components/UserCardPopover';\nimport { formatMentionText } from '~components/UserMention/utils';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport utils from '~utils/main';\n\nconst PAGE_NAME = 'comment';\n\nconst CREATED_AT_FORMAT = 'MM/DD/YY HH:mm';\nconst CREATED_AT_FORMAT_NATIVE = 'MM/DD HH:mm';\n\nconst style = {\n chatAvatarWrapper: {\n paddingTop: 2,\n position: 'absolute',\n top: 6,\n left: 0,\n },\n commentInfoContainer: {\n display: 'inline-flex',\n alignItems: 'center',\n width: '100%',\n paddingTop: 5,\n },\n userNameWrapper: { overflow: 'hidden' },\n infoContainer: {\n display: 'inline-block',\n verticalAlign: 'top',\n width: '100%',\n paddingLeft: 33,\n },\n};\n\nconst muiStyles = theme => ({\n commentWrapper: { width: '100%' },\n timeRoot: {\n color: theme.palette.primary.text7,\n float: 'right',\n marginRight: 5,\n marginLeft: 8,\n fontSize: '12px',\n },\n textRoot: {\n marginTop: 5,\n color: '#CCC',\n fontWeight: 'normal',\n fontSize: '14px',\n },\n iconButtonRoot: {\n float: 'right',\n visibility: 'hidden',\n color: theme.palette.primary.text7,\n },\n userName: {\n fontSize: '12px',\n fontWeight: 'bold',\n },\n});\n\nconst emptyUser = {};\n\n/** @param {any} props Preserve the legacy component's public prop type. */\nfunction Comment({\n comment,\n showOnMount = false,\n spaceAround = false,\n handleShowOnMount = noop,\n handleDeleteCallback,\n patchCommentCallback,\n companyId = null,\n currentUser = emptyUser,\n classes,\n isNative = isNativeDetected,\n}) {\n const {\n actionsMenuAnchorEl,\n isLoading,\n isEditing,\n openDeleteDialog,\n inputEl,\n commentEl,\n handleOpenActionsMenu,\n handleCloseActionsMenu,\n handleEditMenuItem,\n onEditFinish,\n setIsEditting,\n handleDeleteMenuItem,\n handleCloseDeleteDialog,\n handleDelete,\n } = useComment({ comment, showOnMount, handleShowOnMount, handleDeleteCallback });\n const isCurrentUserCommentCreator =\n Number(get(comment, ['user', 'id'])) === Number(currentUser.id);\n\n const renderMenuIcon = () => {\n const showEdit = isCurrentUserCommentCreator;\n\n const showDelete = isCurrentUserCommentCreator || includes(comment.allowed_actions, 'destroy');\n\n if (!(showDelete || showEdit)) return null;\n\n return (\n <div className={styles.cCommentMenu}>\n <IconButton\n data-testid={`${PAGE_NAME}_menuButton`}\n aria-label=\"Actions\"\n aria-owns={actionsMenuAnchorEl ? 'c-comment__actions-menu' : undefined}\n aria-haspopup=\"true\"\n className={classes.iconButtonRoot}\n size=\"small\"\n onClick={handleOpenActionsMenu}\n >\n <MoreVertIcon />\n </IconButton>\n\n <Menu\n id=\"c-comment__actions-menu\"\n anchorOrigin={{ vertical: 'top', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n anchorEl={actionsMenuAnchorEl}\n open={!!actionsMenuAnchorEl}\n onClick={handleCloseActionsMenu}\n onClose={handleCloseActionsMenu}\n >\n {showEdit && (\n <MenuItem data-testid={`${PAGE_NAME}_editMenuItem`} onClick={handleEditMenuItem}>\n Edit\n </MenuItem>\n )}\n\n {showDelete && (\n <MenuItem data-testid={`${PAGE_NAME}_deleteMenuItem`} onClick={handleDeleteMenuItem}>\n Delete\n </MenuItem>\n )}\n </Menu>\n </div>\n );\n };\n\n if (isLoading) {\n return <CommentLoader spaceAround={spaceAround} />;\n }\n\n if (isEditing) {\n return (\n <CommentInput\n inputRef={inputEl}\n postComment={noop}\n exitEditMode={onEditFinish}\n setIsEditting={setIsEditting}\n patchCommentCallback={patchCommentCallback}\n companyId={companyId}\n currentUser={currentUser}\n editFeedItemId={comment.feed_activity_id}\n editCommentId={comment.id}\n editComment={comment.body}\n editAttachment={comment.attachment}\n />\n );\n }\n\n const userFullName = utils.getUserFullName(comment.user);\n\n const format = isNative ? CREATED_AT_FORMAT_NATIVE : CREATED_AT_FORMAT;\n const time = moment(comment.created_at).format(format);\n\n const attachmentUrl = comment?.attachment?.signed_url || comment?.attachment?.url;\n const attachmentSize = get(comment, ['attachment', 'size']);\n const attachmentFileName = get(comment, ['attachment', 'file_name']);\n\n return (\n <div\n data-testid={`${PAGE_NAME}_commentItem_${comment.body}`}\n className={classNames(styles.cComment, { [styles.cCommentNative]: isNative })}\n ref={commentEl}\n >\n <CommentWrapper spaceAround={spaceAround} className={classes.commentWrapper}>\n <div style={style.chatAvatarWrapper}>\n {isNative ? (\n <Avatar\n size={24}\n displayName={userFullName}\n imgSrc={get(comment, ['user', 'profile_photo'])}\n className={classes.avatar}\n />\n ) : (\n <UserCardPopover user={comment.user} currentUser={currentUser}>\n <Avatar\n size={24}\n displayName={userFullName}\n imgSrc={get(comment, ['user', 'profile_photo'])}\n className={classes.avatar}\n />\n </UserCardPopover>\n )}\n </div>\n\n <div style={style.infoContainer}>\n <div>\n <div style={style.commentInfoContainer}>\n <div style={style.userNameWrapper}>\n <Typography\n data-testid={`${PAGE_NAME}_userName`}\n variant=\"subtitle2\"\n noWrap\n className={classes.userName}\n >\n {userFullName}\n </Typography>\n </div>\n\n <div style={style.timeWrapper}>\n <Typography\n data-testid={`${PAGE_NAME}_addTime`}\n variant=\"caption\"\n classes={{ root: classes.timeRoot }}\n >\n {time}\n </Typography>\n </div>\n </div>\n </div>\n\n <div className={styles.cCommentBody}>\n {renderMenuIcon()}\n <Typography\n data-testid={`${PAGE_NAME}_commentMessage`}\n variant=\"body1\"\n classes={{ root: classes.textRoot }}\n >\n {formatMentionText(\n comment.body,\n comment.mentioned_users,\n isNative,\n '#00bcd4',\n currentUser\n )}\n </Typography>\n\n {attachmentUrl && (\n <Attachment\n attachmentUrl={attachmentUrl}\n attachmentSize={attachmentSize}\n size=\"small\"\n fileName={attachmentFileName}\n />\n )}\n </div>\n </div>\n </CommentWrapper>\n\n {openDeleteDialog && (\n <ConfirmationDialog\n open={openDeleteDialog}\n text=\"Do you really want to delete comment?\"\n handleClose={handleCloseDeleteDialog}\n handleOk={handleDelete}\n okText=\"Delete\"\n />\n )}\n </div>\n );\n}\n\nComment.propTypes = {\n comment: PropTypes.shape({}).isRequired,\n showOnMount: PropTypes.bool,\n spaceAround: PropTypes.bool,\n handleShowOnMount: PropTypes.func,\n handleEdit: PropTypes.func,\n handleDeleteCallback: PropTypes.func.isRequired,\n patchCommentCallback: PropTypes.func.isRequired,\n companyId: PropTypes.number,\n currentUser: PropTypes.shape(),\n\n classes: PropTypes.shape({}).isRequired,\n isNative: PropTypes.bool,\n};\n\nexport default withStyles(muiStyles)(memo(Comment));\n"],"names":["style","chatAvatarWrapper","paddingTop","position","top","left","commentInfoContainer","display","alignItems","width","userNameWrapper","overflow","infoContainer","verticalAlign","paddingLeft","emptyUser","Comment","_ref","_comment$attachment","_comment$attachment2","comment","_ref$showOnMount","showOnMount","_ref$spaceAround","spaceAround","_ref$handleShowOnMoun","handleShowOnMount","noop","handleDeleteCallback","patchCommentCallback","_ref$companyId","companyId","_ref$currentUser","currentUser","classes","_ref$isNative","isNative","isNativeDetected","_useComment","useComment","actionsMenuAnchorEl","isLoading","isEditing","openDeleteDialog","inputEl","commentEl","handleOpenActionsMenu","handleCloseActionsMenu","handleEditMenuItem","onEditFinish","setIsEditting","handleDeleteMenuItem","handleCloseDeleteDialog","handleDelete","isCurrentUserCommentCreator","Number","get","id","_jsx","CommentLoader","CommentInput","inputRef","postComment","exitEditMode","editFeedItemId","feed_activity_id","editCommentId","editComment","body","editAttachment","attachment","showEdit","showDelete","userFullName","utils","getUserFullName","user","format","time","moment","created_at","attachmentUrl","signed_url","url","attachmentSize","attachmentFileName","_jsxs","concat","className","classNames","styles","cComment","cCommentNative","ref","children","CommentWrapper","commentWrapper","jsx","Avatar","size","displayName","imgSrc","avatar","UserCardPopover","jsxs","Typography","variant","noWrap","userName","timeWrapper","root","timeRoot","cCommentBody","includes","allowed_actions","cCommentMenu","IconButton","undefined","iconButtonRoot","onClick","MoreVertIcon","Menu","anchorOrigin","vertical","horizontal","transformOrigin","anchorEl","open","onClose","MenuItem","textRoot","formatMentionText","mentioned_users","Attachment","fileName","ConfirmationDialog","text","handleClose","handleOk","okText","propTypes","PropTypes","shape","isRequired","bool","func","handleEdit","number","withStyles","theme","color","palette","primary","text7","float","marginRight","marginLeft","fontSize","marginTop","fontWeight","visibility","memo"],"mappings":"g+BAiCMA,EAAQ,CACZC,kBAAmB,CACjBC,WAAY,EACZC,SAAU,WACVC,IAAK,EACLC,KAAM,GAERC,qBAAsB,CACpBC,QAAS,cACTC,WAAY,SACZC,MAAO,OACPP,WAAY,GAEdQ,gBAAiB,CAAEC,SAAU,UAC7BC,cAAe,CACbL,QAAS,eACTM,cAAe,MACfJ,MAAO,OACPK,YAAa,KA8BXC,EAAY,CAAA,EAGlB,SAASC,EAWNC,GAAA,IAAAC,EAAAC,EAVDC,IAAAA,QAAOC,EAAAJ,EACPK,YAAAA,cAAmBD,EAAAE,EAAAN,EACnBO,YAAAA,cAAmBD,EAAAE,EAAAR,EACnBS,kBAAAA,aAAoBC,EAAIA,KAAAF,EACxBG,IAAAA,qBACAC,IAAAA,qBAAoBC,EAAAb,EACpBc,UAAAA,aAAY,KAAID,EAAAE,EAAAf,EAChBgB,YAAAA,aAAclB,EAASiB,EACvBE,IAAAA,QAAOC,EAAAlB,EACPmB,SAAAA,aAAWC,EAAA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GAAIC,WAC7BzH,YAAauH,EAAS,QAACG,KACvBxH,YAAaqH,EAAS,QAACG,KACvBtH,kBAAmBmH,EAAS,QAACI,KAC7BC,WAAYL,EAAS,QAACI,KACtBrH,qBAAsBiH,EAAAA,QAAUI,KAAKF,WACrClH,qBAAsBgH,EAAAA,QAAUI,KAAKF,WACrChH,UAAW8G,EAAS,QAACM,OACrBlH,YAAa4G,EAAS,QAACC,QAEvB5G,QAAS2G,EAAS,QAACC,MAAM,CAAA,GAAIC,WAC7B3G,SAAUyG,EAAS,QAACG,MAGtB,IAAeI,EAAAA,EAAAA,YAtPG,SAAAC,GAAK,MAAK,CAC1BrD,eAAgB,CAAEvF,MAAO,QACzBsG,SAAU,CACRuC,MAAOD,EAAME,QAAQC,QAAQC,MAC7BC,MAAO,QACPC,YAAa,EACbC,WAAY,EACZC,SAAU,QAEZ3B,SAAU,CACR4B,UAAW,EACXR,MAAO,OACPS,WAAY,SACZF,SAAU,QAEZvC,eAAgB,CACdoC,MAAO,QACPM,WAAY,SACZV,MAAOD,EAAME,QAAQC,QAAQC,OAE/B7C,SAAU,CACRiD,SAAU,OACVE,WAAY,QAEf,GA8NcX,CAAsBa,EAAIA,KAACjJ"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@babel/runtime/helpers/asyncToGenerator"),n=require("@babel/runtime/helpers/slicedToArray"),t=require("@babel/runtime/regenerator"),u=require("react"),r=require("../../clients/jsonApi/index.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=o(e),c=o(n),i=o(t);module.exports=function(e){var n=e.comment,t=e.showOnMount,o=e.handleShowOnMount,l=e.handleDeleteCallback,s=u.useState(null),d=c.default(s,2),f=d[0],h=d[1],m=u.useState(!1),p=c.default(m,2),v=p[0],E=p[1],y=u.useState(!1),w=c.default(y,2),b=w[0],M=w[1],g=u.useState(!1),k=c.default(g,2),L=k[0],D=k[1],O=u.useRef(null),S=u.useRef(null),C=u.useRef({showOnMount:t,handleShowOnMount:o}),q=u.useRef(l);u.useLayoutEffect((function(){q.current=l}),[l]),u.useLayoutEffect((function(){C.current.showOnMount&&(C.current.handleShowOnMount(),S.current.scrollIntoView({block:"end"}))}),[]),u.useLayoutEffect((function(){b&&O.current&&O.current.focus()}),[b]);var x=u.useCallback((function(e){27===e.keyCode&&M(!1),document.removeEventListener("keydown",x,!1)}),[]);u.useLayoutEffect((function(){return function(){return document.removeEventListener("keydown",x,!1)}}),[x]);var A,I=(A=a.default(i.default.mark((function e(){var t,u,o;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.id,u=n.feed_activity_id,E(!0),e.prev=2,e.next=5,r.deleteFeedItemComment(u,t);case 5:o=e.sent,e.next=11;break;case 8:e.prev=8,e.t0=e.catch(2),console.error(e.t0);case 11:E(!1),D(!1),o&&q.current(t);case 14:case"end":return e.stop()}}),e,null,[[2,8]])}))),function(){return A.apply(this,arguments)});return{actionsMenuAnchorEl:f,isLoading:v,isEditing:b,openDeleteDialog:L,inputEl:O,commentEl:S,handleOpenActionsMenu:function(e){e.stopPropagation(),h(e.currentTarget)},handleCloseActionsMenu:function(e){e.stopPropagation(),h(null)},handleEditMenuItem:function(){document.addEventListener("keydown",x,!1),M(!0)},onEditFinish:function(){M(!1),E(!1)},setIsEditting:function(){return E(!0)},handleDeleteMenuItem:function(){return D(!0)},handleCloseDeleteDialog:function(){return D(!1)},handleDelete:I}};
2
+ //# sourceMappingURL=useComment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useComment.js","sources":["../../../../src/components/Comment/useComment.js"],"sourcesContent":["import { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { deleteFeedItemComment } from '../../clients/jsonApi';\n\nexport default function useComment({\n comment,\n showOnMount,\n handleShowOnMount,\n handleDeleteCallback,\n}) {\n const [actionsMenuAnchorEl, setActionsMenuAnchorEl] = useState(null);\n const [isLoading, setIsLoading] = useState(false);\n const [isEditing, setIsEditing] = useState(false);\n const [openDeleteDialog, setOpenDeleteDialog] = useState(false);\n const inputEl = useRef(null);\n const commentEl = useRef(null);\n const initialMount = useRef({ showOnMount, handleShowOnMount });\n const deleteCallback = useRef(handleDeleteCallback);\n\n useLayoutEffect(() => {\n deleteCallback.current = handleDeleteCallback;\n }, [handleDeleteCallback]);\n\n useLayoutEffect(() => {\n if (initialMount.current.showOnMount) {\n initialMount.current.handleShowOnMount();\n commentEl.current.scrollIntoView({ block: 'end' });\n }\n }, []);\n\n useLayoutEffect(() => {\n if (isEditing && inputEl.current) inputEl.current.focus();\n }, [isEditing]);\n\n const handleKeyDown = useCallback(event => {\n if (event.keyCode === 27) setIsEditing(false);\n document.removeEventListener('keydown', handleKeyDown, false);\n }, []);\n\n useLayoutEffect(\n () => () => document.removeEventListener('keydown', handleKeyDown, false),\n [handleKeyDown]\n );\n\n const handleEditMenuItem = () => {\n document.addEventListener('keydown', handleKeyDown, false);\n setIsEditing(true);\n };\n\n const handleDelete = async () => {\n const { id, feed_activity_id: feedItemId } = comment;\n setIsLoading(true);\n let response;\n try {\n response = await deleteFeedItemComment(feedItemId, id);\n } catch (error) {\n console.error(error);\n }\n setIsLoading(false);\n setOpenDeleteDialog(false);\n if (response) deleteCallback.current(id);\n };\n\n return {\n actionsMenuAnchorEl,\n isLoading,\n isEditing,\n openDeleteDialog,\n inputEl,\n commentEl,\n handleOpenActionsMenu: event => {\n event.stopPropagation();\n setActionsMenuAnchorEl(event.currentTarget);\n },\n handleCloseActionsMenu: event => {\n event.stopPropagation();\n setActionsMenuAnchorEl(null);\n },\n handleEditMenuItem,\n onEditFinish: () => {\n setIsEditing(false);\n setIsLoading(false);\n },\n setIsEditting: () => setIsLoading(true),\n handleDeleteMenuItem: () => setOpenDeleteDialog(true),\n handleCloseDeleteDialog: () => setOpenDeleteDialog(false),\n handleDelete,\n };\n}\n"],"names":["_ref","comment","showOnMount","handleShowOnMount","handleDeleteCallback","useState","_useState2","_slicedToArray","_useState","actionsMenuAnchorEl","setActionsMenuAnchorEl","_useState4","_useState3","isLoading","setIsLoading","_useState6","_useState5","isEditing","setIsEditing","_useState8","_useState7","openDeleteDialog","setOpenDeleteDialog","inputEl","useRef","commentEl","initialMount","deleteCallback","useLayoutEffect","current","scrollIntoView","block","focus","handleKeyDown","useCallback","event","keyCode","document","removeEventListener","_ref2","handleDelete","_asyncToGenerator","_regeneratorRuntime","mark","_callee","id","feedItemId","response","wrap","_context","prev","next","feed_activity_id","deleteFeedItemComment","sent","t0","console","error","stop","apply","this","arguments","handleOpenActionsMenu","stopPropagation","currentTarget","handleCloseActionsMenu","handleEditMenuItem","addEventListener","onEditFinish","setIsEditting","handleDeleteMenuItem","handleCloseDeleteDialog"],"mappings":"+UAGe,SAKZA,GAAA,IAJDC,IAAAA,QACAC,IAAAA,YACAC,IAAAA,kBACAC,IAAAA,qBAEsDC,EAAAA,EAAQA,SAAC,MAAKC,EAAAC,EAAAA,QAAAC,EAAA,GAA7DC,EAAmBH,EAAA,GAAEI,EAAsBJ,EAAA,GAChBD,EAAAA,EAAQA,UAAC,GAAMM,EAAAJ,EAAAA,QAAAK,EAAA,GAA1CC,EAASF,EAAA,GAAEG,EAAYH,EAAA,GACIN,EAAAA,EAAQA,UAAC,GAAMU,EAAAR,EAAAA,QAAAS,EAAA,GAA1CC,EAASF,EAAA,GAAEG,EAAYH,EAAA,GACkBV,EAAAA,EAAQA,UAAC,GAAMc,EAAAZ,EAAAA,QAAAa,EAAA,GAAxDC,EAAgBF,EAAA,GAAEG,EAAmBH,EAAA,GACtCI,EAAUC,SAAO,MACjBC,EAAYD,SAAO,MACnBE,EAAeF,EAAAA,OAAO,CAAEtB,YAAAA,EAAaC,kBAAAA,IACrCwB,EAAiBH,SAAOpB,GAE9BwB,EAAAA,iBAAgB,WACdD,EAAeE,QAAUzB,CAC3B,GAAG,CAACA,IAEJwB,EAAAA,iBAAgB,WACVF,EAAaG,QAAQ3B,cACvBwB,EAAaG,QAAQ1B,oBACrBsB,EAAUI,QAAQC,eAAe,CAAEC,MAAO,QAE7C,GAA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ACDwD,mBAlCyB,WACzB7B,SAAS8B,iBAAiB,UAAWlC,GAAe,GACpDf,GAAa,IAiCbkD,aAAc,WACZlD,GAAa,GACbJ,GAAa,EACd,EACDuD,cAAe,WAAA,OAAMvD,GAAa,EAAK,EACvCwD,qBAAsB,WAAA,OAAMhD,GAAoB,EAAK,EACrDiD,wBAAyB,WAAA,OAAMjD,GAAoB,EAAM,EACzDkB,aAAAA,EAEJ"}
@@ -1,2 +1,2 @@
1
- "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".CommentCard_capped__izWBZ{display:flex;flex-direction:column;overflow:hidden}.CommentCard_bodySurface__scobR{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;overflow:hidden;padding:8px 12px}.CommentCard_editHeader__8aUBt{padding:8px 12px 0}.CommentCard_scrollBody__CIun9{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;overflow-x:hidden;overflow-y:auto}.CommentCard_footer__z3-CY{border-top:1px solid var(--palette-background-b-4);display:flex;flex-direction:column;flex-shrink:0;padding:4px 12px 8px}.CommentCard_repliesSection__iE7QO{padding:8px 12px 12px}.CommentCard_compactBody__zM10O{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;overflow:hidden;padding:8px 12px}.CommentCard_compactTop__LpiQi{align-items:center;display:flex;flex-shrink:0;gap:8px}.CommentCard_compactTime__JzVQR{color:var(--palette-primary-text-7);font-size:12px;line-height:16px;margin-left:auto;white-space:nowrap}.CommentCard_compactFooter__rgB4D{border-top:1px solid var(--palette-background-b-4);flex-shrink:0;padding:4px 12px 8px}.CommentCard_header__T1SH8{align-items:center;display:flex;flex-shrink:0;gap:8px}.CommentCard_headerText__DRsQG{display:flex;flex:1 0 0;flex-direction:column;min-width:0;word-break:break-word}.CommentCard_nameRow__Or1c0{align-items:center;display:flex;gap:8px;width:100%}.CommentCard_nameRow__Or1c0 .CommentCard_timestamp__EbJCO{margin-left:auto}.CommentCard_subtitle__d-XRe{color:var(--palette-primary-main);font-size:12px;line-height:16px}.CommentCard_avatar__NA2ZA{flex-shrink:0}.CommentCard_name__9-e7A{color:var(--palette-primary-text-1);flex:0 1 auto;font-size:14px;line-height:20px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.CommentCard_timestamp__EbJCO{color:var(--palette-primary-text-7)}.CommentCard_chip__4NUrf,.CommentCard_timestamp__EbJCO{flex-shrink:0;font-size:12px;line-height:16px;white-space:nowrap}.CommentCard_chip__4NUrf{align-items:center;background:rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;color:var(--palette-primary-text-6);display:flex;height:24px;padding:6px 8px}.CommentCard_chipAccented__Xl8ek{border-left:2px solid transparent}.CommentCard_bodyRow__ZUufY{align-items:center;display:flex;gap:8px}.CommentCard_text__eAIZM{color:var(--palette-primary-text-1);flex:1 1 auto;font-size:12px;line-height:16px;min-width:0;white-space:pre-wrap;word-break:break-word}.CommentCard_text__eAIZM a,.CommentCard_text__eAIZM button{font:inherit;padding:0;vertical-align:baseline}.CommentCard_attachment__KktIn{display:flex;flex-direction:column;gap:8px}.CommentCard_infoButton__gqcvK{align-items:center;color:var(--palette-primary-text-6);cursor:default;display:inline-flex}.CommentCard_infoButton__gqcvK:hover{color:var(--palette-primary-text-1)}.CommentCard_metadataTooltip__AL0xt .MuiTooltip-tooltip{max-width:none!important}.CommentCard_metadataRows__c-kqf{display:flex;flex-direction:column;gap:4px;padding:4px 0}.CommentCard_metadataRow__BqcII{align-items:baseline;display:flex;font-size:14px;gap:4px;line-height:20px;white-space:nowrap}.CommentCard_metadataLabel__WRWl7{color:var(--palette-primary-text-6)}.CommentCard_metadataValue__Xwf7S{color:var(--palette-primary-text-1)}.CommentCard_metadataUnit__Bxeps{color:var(--palette-primary-text-6);font-size:12px}.CommentCard_contextLine__Jyoui{align-items:center;color:var(--palette-primary-text-7);column-gap:16px;display:flex;flex-wrap:wrap;font-size:12px;line-height:16px;row-gap:4px}.CommentCard_contextItem__2Xmql{white-space:nowrap}.CommentCard_actionsRow__1Ftxn{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentCard_actions__mUmsV{align-items:center;display:flex;gap:8px}.CommentCard_trailingActions__uGt-3{align-items:center;display:flex;gap:4px}.CommentCard_action__ZfyBP{align-items:center;display:flex;gap:2px}.CommentCard_count__stfpY{color:var(--palette-primary-text-6);font-size:12px;line-height:16px}.CommentCard_liked__zsBqe svg{color:var(--palette-primary-main)}.CommentCard_replies__nRRYo{display:flex;flex-direction:column;gap:8px}.CommentCard_reply__7-U7Q{display:flex;flex-direction:column;gap:4px}.CommentCard_replyHeader__sWnLA{align-items:center;display:flex;gap:8px}.CommentCard_replyNameRow__bs7h2{align-items:center;display:flex;flex:1 0 0;gap:12px;min-width:0}.CommentCard_replyName__C8tst{color:var(--palette-primary-text-1);font-size:14px;line-height:20px;white-space:nowrap}.CommentCard_replyTimestamp__YzuW1{color:var(--palette-primary-text-7);flex:1 0 0;font-size:12px;line-height:16px;min-width:0}.CommentCard_replyText__8JPKK{color:var(--palette-primary-text-1);font-size:12px;line-height:16px;padding-left:40px;white-space:pre-wrap;word-break:break-word}.CommentCard_replyText__8JPKK a,.CommentCard_replyText__8JPKK button{font:inherit;padding:0;vertical-align:baseline}"),module.exports={spacing:"8",capped:"CommentCard_capped__izWBZ",bodySurface:"CommentCard_bodySurface__scobR",editHeader:"CommentCard_editHeader__8aUBt",scrollBody:"CommentCard_scrollBody__CIun9",footer:"CommentCard_footer__z3-CY",repliesSection:"CommentCard_repliesSection__iE7QO",compactBody:"CommentCard_compactBody__zM10O",compactTop:"CommentCard_compactTop__LpiQi",compactTime:"CommentCard_compactTime__JzVQR",compactFooter:"CommentCard_compactFooter__rgB4D",header:"CommentCard_header__T1SH8",headerText:"CommentCard_headerText__DRsQG",nameRow:"CommentCard_nameRow__Or1c0",timestamp:"CommentCard_timestamp__EbJCO",subtitle:"CommentCard_subtitle__d-XRe",avatar:"CommentCard_avatar__NA2ZA",name:"CommentCard_name__9-e7A",chip:"CommentCard_chip__4NUrf",chipAccented:"CommentCard_chipAccented__Xl8ek",bodyRow:"CommentCard_bodyRow__ZUufY",text:"CommentCard_text__eAIZM",attachment:"CommentCard_attachment__KktIn",infoButton:"CommentCard_infoButton__gqcvK",metadataTooltip:"CommentCard_metadataTooltip__AL0xt",metadataRows:"CommentCard_metadataRows__c-kqf",metadataRow:"CommentCard_metadataRow__BqcII",metadataLabel:"CommentCard_metadataLabel__WRWl7",metadataValue:"CommentCard_metadataValue__Xwf7S",metadataUnit:"CommentCard_metadataUnit__Bxeps",contextLine:"CommentCard_contextLine__Jyoui",contextItem:"CommentCard_contextItem__2Xmql",actionsRow:"CommentCard_actionsRow__1Ftxn",actions:"CommentCard_actions__mUmsV",trailingActions:"CommentCard_trailingActions__uGt-3",action:"CommentCard_action__ZfyBP",count:"CommentCard_count__stfpY",liked:"CommentCard_liked__zsBqe",replies:"CommentCard_replies__nRRYo",reply:"CommentCard_reply__7-U7Q",replyHeader:"CommentCard_replyHeader__sWnLA",replyNameRow:"CommentCard_replyNameRow__bs7h2",replyName:"CommentCard_replyName__C8tst",replyTimestamp:"CommentCard_replyTimestamp__YzuW1",replyText:"CommentCard_replyText__8JPKK"};
1
+ "use strict";require('./../../ext-esm/style-inject/dist/style-inject.es.js')(".CommentCard_capped__izWBZ{flex-direction:column}.CommentCard_bodySurface__scobR,.CommentCard_capped__izWBZ{overflow-clip-margin:12px;display:flex;overflow:hidden;overflow:clip}.CommentCard_bodySurface__scobR{flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;padding:8px 12px}.CommentCard_editHeader__8aUBt{padding:8px 12px 0}.CommentCard_scrollBody__CIun9{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;margin:0 -24px;min-height:0;overflow-x:hidden;overflow-y:auto;padding:0 24px}.CommentCard_footer__z3-CY{border-top:1px solid var(--palette-background-b-4);display:flex;flex-direction:column;flex-shrink:0;padding:4px 12px 8px}.CommentCard_repliesSection__iE7QO{padding:8px 12px 12px}.CommentCard_compactBody__zM10O{display:flex;flex:1 1 auto;flex-direction:column;gap:8px;min-height:0;overflow:hidden;padding:8px 12px}.CommentCard_compactTop__LpiQi{align-items:center;display:flex;flex-shrink:0;gap:8px}.CommentCard_compactTime__JzVQR{color:var(--palette-primary-text-7);font-size:12px;line-height:16px;margin-left:auto;white-space:nowrap}.CommentCard_compactFooter__rgB4D{border-top:1px solid var(--palette-background-b-4);flex-shrink:0;padding:4px 12px 8px}.CommentCard_header__T1SH8{align-items:center;display:flex;flex-shrink:0;gap:8px}.CommentCard_headerText__DRsQG{display:flex;flex:1 0 0;flex-direction:column;min-width:0;word-break:break-word}.CommentCard_nameRow__Or1c0{align-items:center;display:flex;gap:8px;width:100%}.CommentCard_nameRow__Or1c0 .CommentCard_timestamp__EbJCO{margin-left:auto}.CommentCard_subtitle__d-XRe{color:var(--palette-primary-main);font-size:12px;line-height:16px}.CommentCard_avatar__NA2ZA{flex-shrink:0}.CommentCard_name__9-e7A{color:var(--palette-primary-text-1);flex:0 1 auto;font-size:14px;line-height:20px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.CommentCard_timestamp__EbJCO{color:var(--palette-primary-text-7)}.CommentCard_chip__4NUrf,.CommentCard_timestamp__EbJCO{flex-shrink:0;font-size:12px;line-height:16px;white-space:nowrap}.CommentCard_chip__4NUrf{align-items:center;background:rgb(from var(--palette-primary-text-1) r g b/.04);border-radius:8px;color:var(--palette-primary-text-6);display:flex;height:24px;padding:6px 8px}.CommentCard_chipAccented__Xl8ek{border-left:2px solid transparent}.CommentCard_bodyRow__ZUufY{align-items:center;display:flex;gap:8px}.CommentCard_text__eAIZM{color:var(--palette-primary-text-1);flex:1 1 auto;font-size:12px;line-height:16px;min-width:0;white-space:pre-wrap;word-break:break-word}.CommentCard_text__eAIZM a,.CommentCard_text__eAIZM button{font:inherit;padding:0;vertical-align:baseline}.CommentCard_attachment__KktIn{--attachment-arrow-outset:12px;display:flex;flex-direction:column;gap:8px}.CommentCard_infoButton__gqcvK{align-items:center;color:var(--palette-primary-text-6);cursor:default;display:inline-flex}.CommentCard_infoButton__gqcvK:hover{color:var(--palette-primary-text-1)}.CommentCard_metadataTooltip__AL0xt .MuiTooltip-tooltip{max-width:none!important}.CommentCard_metadataRows__c-kqf{display:flex;flex-direction:column;gap:4px;padding:4px 0}.CommentCard_metadataRow__BqcII{align-items:baseline;display:flex;font-size:14px;gap:4px;line-height:20px;white-space:nowrap}.CommentCard_metadataLabel__WRWl7{color:var(--palette-primary-text-6)}.CommentCard_metadataValue__Xwf7S{color:var(--palette-primary-text-1)}.CommentCard_metadataUnit__Bxeps{color:var(--palette-primary-text-6);font-size:12px}.CommentCard_contextLine__Jyoui{align-items:center;color:var(--palette-primary-text-7);column-gap:16px;display:flex;flex-wrap:wrap;font-size:12px;line-height:16px;row-gap:4px}.CommentCard_contextItem__2Xmql{white-space:nowrap}.CommentCard_actionsRow__1Ftxn{align-items:center;display:flex;justify-content:space-between;width:100%}.CommentCard_actions__mUmsV{align-items:center;display:flex;gap:8px}.CommentCard_trailingActions__uGt-3{align-items:center;display:flex;gap:4px}.CommentCard_action__ZfyBP{align-items:center;display:flex;gap:2px}.CommentCard_count__stfpY{color:var(--palette-primary-text-6);font-size:12px;line-height:16px}.CommentCard_liked__zsBqe svg{color:var(--palette-primary-main)}.CommentCard_replies__nRRYo{display:flex;flex-direction:column;gap:8px}.CommentCard_reply__7-U7Q{display:flex;flex-direction:column;gap:4px}.CommentCard_replyHeader__sWnLA{align-items:center;display:flex;gap:8px}.CommentCard_replyNameRow__bs7h2{align-items:center;display:flex;flex:1 0 0;gap:12px;min-width:0}.CommentCard_replyName__C8tst{color:var(--palette-primary-text-1);font-size:14px;line-height:20px;white-space:nowrap}.CommentCard_replyTimestamp__YzuW1{color:var(--palette-primary-text-7);flex:1 0 0;font-size:12px;line-height:16px;min-width:0}.CommentCard_replyText__8JPKK{color:var(--palette-primary-text-1);font-size:12px;line-height:16px;padding-left:40px;white-space:pre-wrap;word-break:break-word}.CommentCard_replyText__8JPKK a,.CommentCard_replyText__8JPKK button{font:inherit;padding:0;vertical-align:baseline}"),module.exports={spacing:"8",capped:"CommentCard_capped__izWBZ",bodySurface:"CommentCard_bodySurface__scobR",editHeader:"CommentCard_editHeader__8aUBt",scrollBody:"CommentCard_scrollBody__CIun9",footer:"CommentCard_footer__z3-CY",repliesSection:"CommentCard_repliesSection__iE7QO",compactBody:"CommentCard_compactBody__zM10O",compactTop:"CommentCard_compactTop__LpiQi",compactTime:"CommentCard_compactTime__JzVQR",compactFooter:"CommentCard_compactFooter__rgB4D",header:"CommentCard_header__T1SH8",headerText:"CommentCard_headerText__DRsQG",nameRow:"CommentCard_nameRow__Or1c0",timestamp:"CommentCard_timestamp__EbJCO",subtitle:"CommentCard_subtitle__d-XRe",avatar:"CommentCard_avatar__NA2ZA",name:"CommentCard_name__9-e7A",chip:"CommentCard_chip__4NUrf",chipAccented:"CommentCard_chipAccented__Xl8ek",bodyRow:"CommentCard_bodyRow__ZUufY",text:"CommentCard_text__eAIZM",attachment:"CommentCard_attachment__KktIn",infoButton:"CommentCard_infoButton__gqcvK",metadataTooltip:"CommentCard_metadataTooltip__AL0xt",metadataRows:"CommentCard_metadataRows__c-kqf",metadataRow:"CommentCard_metadataRow__BqcII",metadataLabel:"CommentCard_metadataLabel__WRWl7",metadataValue:"CommentCard_metadataValue__Xwf7S",metadataUnit:"CommentCard_metadataUnit__Bxeps",contextLine:"CommentCard_contextLine__Jyoui",contextItem:"CommentCard_contextItem__2Xmql",actionsRow:"CommentCard_actionsRow__1Ftxn",actions:"CommentCard_actions__mUmsV",trailingActions:"CommentCard_trailingActions__uGt-3",action:"CommentCard_action__ZfyBP",count:"CommentCard_count__stfpY",liked:"CommentCard_liked__zsBqe",replies:"CommentCard_replies__nRRYo",reply:"CommentCard_reply__7-U7Q",replyHeader:"CommentCard_replyHeader__sWnLA",replyNameRow:"CommentCard_replyNameRow__bs7h2",replyName:"CommentCard_replyName__C8tst",replyTimestamp:"CommentCard_replyTimestamp__YzuW1",replyText:"CommentCard_replyText__8JPKK"};
2
2
  //# sourceMappingURL=CommentCard.scss.js.map
@@ -1,2 +1,2 @@
1
- "use strict";var t=require("@babel/runtime/helpers/asyncToGenerator"),e=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/assertThisInitialized"),i=require("@babel/runtime/helpers/inherits"),s=require("@babel/runtime/helpers/possibleConstructorReturn"),r=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),l=require("@babel/runtime/regenerator"),u=require("react"),c=require("prop-types"),d=require("lodash/noop"),p=require("@material-ui/core/styles"),m=require("@material-ui/core"),h=require("classnames"),f=require("lodash"),g=require("@material-ui/core/colors/grey"),C=require("../../clients/jsonApi/index.js"),x=require("./styles.css.js"),v=require("../Avatar/index.js"),b=require("../FileUploadIconButton.js"),I=require("../EmojiIconButton.js"),y=require("../FailedFileUploading.js"),j=require("../UserMention/index.js"),F=require("../FilePreview/index.js"),E=require("../IconButton/index.js"),S=require("../Icons/SendIcon.js"),q=require("../UserMention/utils/index.js"),U=require("../../utils/main.js"),A=require("../../utils/mobileDetect.js"),N=require("../../utils/nativeMessages.js"),k=require("react/jsx-runtime");function M(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var R=M(t),P=M(e),T=M(n),B=M(a),w=M(i),L=M(s),z=M(r),D=M(o),_=M(l),O=M(c),H=M(d),K=M(h),V=M(g);function W(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,a=z.default(t);if(e){var i=z.default(this).constructor;n=Reflect.construct(a,arguments,i)}else n=a.apply(this,arguments);return L.default(this,n)}}var G={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},J=function(t){w.default(n,t);var e=W(n);function n(t){var a,i,s;return P.default(this,n),a=e.call(this,t),D.default(B.default(a),"handleSelectEmoji",(function(t){return a.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),D.default(B.default(a),"postComment",(i=R.default(_.default.mark((function t(e){var n;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,a.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return i.apply(this,arguments)})),D.default(B.default(a),"patchComment",(s=R.default(_.default.mark((function t(e){var n,i,s,r;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=a.props,i=n.editFeedItemId,s=n.editCommentId,t.prev=1,t.next=4,C.patchFeedItemComment(i,s,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return s.apply(this,arguments)})),D.default(B.default(a),"clearCommentField",(function(t){a.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){a.focusOnRef(),t&&"function"==typeof t&&t()}))})),D.default(B.default(a),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&a.props.exitEditMode(),"Enter"===e&&(q.isSuggestionsListOpened()||(t.preventDefault(),a.handleSendComment()))})),D.default(B.default(a),"handleAttachmentLoadingError",(function(t){a.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),D.default(B.default(a),"handleFileUpload",(function(t,e,n){a.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),D.default(B.default(a),"handleNativeFileUpload",(function(){var t=a.state.comment;a.isEditMode?(N.notifyCommentEdit(t),a.clearCommentField(a.props.exitEditMode)):(N.notifyCommentPost(t),a.clearCommentField())})),D.default(B.default(a),"handleFileDelete",(function(){return a.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),D.default(B.default(a),"handleSendComment",R.default(_.default.mark((function t(){var e,n,i;return _.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=a.state.comment?a.state.comment.trim():null)||a.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:a.state.attachmentUrl,size:a.state.attachmentSize,file_name:a.state.attachmentName}}},!a.isEditMode){t.next=16;break}return a.props.setIsEditting(!0),t.next=8,a.patchComment(n);case 8:return i=t.sent,t.next=11,a.props.patchCommentCallback(i);case 11:a.props.setIsEditting(!1),a.clearCommentField(),a.props.exitEditMode(),t.next=24;break;case 16:return a.props.setIsPosting(!0),t.next=19,a.postComment(n);case 19:return i=t.sent,t.next=22,a.props.postCommentCallback(i);case 22:a.props.setIsPosting(!1),a.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),D.default(B.default(a),"handleCancelClick",(function(){a.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},a.props.exitEditMode())})),a.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},a}return T.default(n,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:t?this.props.editAttachment.file_name||U.default.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.size:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t,e=this,n=this.props,a=n.classes,i=n.currentUser,s="".concat(f.get(i,["attributes","first_name"])||f.get(i,"first_name")," ").concat(f.get(i,["attributes","last_name"])||f.get(i,"last_name")),r=this.state.isInputFocused||this.state.attachmentUrl||this.state.comment||this.props.editComment||(null===(t=this.props.editAttachment)||void 0===t?void 0:t.url);return k.jsxs("div",{style:this.props.spaceAround?G.commentTextFieldContainerSpaceAround:G.commentTextFieldContainer,children:[k.jsx("div",{style:G.chatAvatarWrapper,children:k.jsx(v.AvatarComponent,{displayName:s,size:32,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),k.jsx(m.Paper,{className:this.props.classes.paperRoot,children:k.jsx(m.TextField,{"data-testid":"".concat("commentInput","_input"),placeholder:"Type Comment",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:j,inputProps:{onChange:function(t){return e.setState({comment:t})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return e.setState({isInputFocused:!0})},onBlur:function(){return e.setState({isInputFocused:!1})},allowSuggestionsAboveCursor:!0},endAdornment:!this.props.isNative&&k.jsxs(m.InputAdornment,{position:"end",className:this.props.classes.inputAdornment,children:[!this.state.attachmentUrl&&k.jsx("div",{className:K.default(x.cCommentInputIconContainer,x.cCommentInputIconUpload),children:k.jsx(b.default,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:V.default[400],inputId:"comment-attachment-".concat(this.props.editCommentId||this.props.parentId),tooltipProps:{title:"Attach File",classes:{tooltip:a.iconTooltip},placement:"top"}})}),k.jsx("div",{className:x.cCommentInputIconContainer,children:k.jsx(I,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:V.default[400],disableRipple:!0,tooltipProps:{title:"Add Emoji",classes:{tooltip:a.iconTooltip},placement:"top"}})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&k.jsx(y,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&k.jsx(F,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),k.jsx(m.Collapse,{in:r,mountOnEnter:!0,unmountOnExit:!0,children:k.jsxs("div",{className:x.cCommentInputSendContainer,children:[k.jsx("div",{className:x.cCommentInputSendContainerCancel,children:k.jsx(m.Typography,{"data-testid":"".concat("commentInput","_cancel"),variant:"caption",className:K.default(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),k.jsxs("div",{className:x.cCommentInputSendContainerSend,children:[k.jsxs(m.Typography,{variant:"caption",className:K.default(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",k.jsx(m.Typography,{variant:"caption",color:"primary",className:K.default(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),k.jsx(E,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:k.jsx(S,{})})]})]})})]})}}]),n}(u.PureComponent);J.propTypes={inputRef:O.default.shape({current:O.default.shape({focus:O.default.shape({})})}),editFeedItemId:O.default.number,editCommentId:O.default.number,editComment:O.default.string,editAttachment:O.default.shape({url:O.default.string,size:O.default.number,file_name:O.default.string}),spaceAround:O.default.bool,postComment:O.default.func.isRequired,postCommentCallback:O.default.func,patchCommentCallback:O.default.func,exitEditMode:O.default.func,setIsPosting:O.default.func,setIsEditting:O.default.func,onMount:O.default.func,autoFocus:O.default.bool,disabled:O.default.bool,classes:O.default.shape({}).isRequired,currentUser:O.default.shape(),isNative:O.default.bool,companyId:O.default.number,parentId:O.default.string},J.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,parentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:H.default,setIsEditting:H.default,onMount:H.default,autoFocus:void 0,disabled:!1,patchCommentCallback:H.default,postCommentCallback:H.default,exitEditMode:H.default,companyId:null,currentUser:{},isNative:A.isNativeDetected};var Q=p.withStyles((function(t){return{paperRoot:{width:"calc(100% - 48px)",marginLeft:48,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none",background:"#4D4D4D"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"8px",lineHeight:"29px",paddingLeft:"8px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"6px"},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}},inputAdornment:{marginBottom:"0!important",height:"100%"}}}))(J);module.exports=Q;
1
+ "use strict";var e=require("react"),t=require("prop-types"),n=require("lodash/noop"),i=require("@material-ui/core/styles"),o=require("@material-ui/core"),a=require("classnames"),l=require("lodash"),r=require("@material-ui/core/colors/grey"),d=require("./useCommentInput.js"),s=require("./styles.css.js"),u=require("../Avatar/index.js"),c=require("../FileUploadIconButton.js"),p=require("../EmojiIconButton.js"),m=require("../FailedFileUploading.js"),h=require("../UserMention/index.js"),f=require("../FilePreview/index.js"),g=require("../IconButton/index.js"),x=require("../Icons/SendIcon.js"),C=require("../../utils/mobileDetect.js"),v=require("react/jsx-runtime");function I(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var j=I(t),b=I(n),y=I(a),F=I(r),A={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},q={},E=e.forwardRef((function(t,n){var i=t.inputRef,a=void 0===i?null:i,r=t.editFeedItemId,I=void 0===r?null:r,j=t.editCommentId,E=void 0===j?null:j,N=t.parentId,T=void 0===N?null:N,B=t.editComment,S=void 0===B?null:B,U=t.editAttachment,R=void 0===U?q:U,w=t.spaceAround,M=void 0!==w&&w,P=t.postComment,k=t.setIsPosting,L=void 0===k?b.default:k,D=t.setIsEditting,_=void 0===D?b.default:D,H=t.onMount,z=void 0===H?b.default:H,O=t.autoFocus,K=t.disabled,W=void 0!==K&&K,G=t.patchCommentCallback,J=void 0===G?b.default:G,Q=t.postCommentCallback,V=void 0===Q?b.default:Q,X=t.exitEditMode,Y=void 0===X?b.default:X,Z=t.companyId,$=void 0===Z?null:Z,ee=t.currentUser,te=void 0===ee?q:ee,ne=t.isNative,ie=void 0===ne?C.isNativeDetected:ne,oe=t.classes,ae=d({inputRef:a,editFeedItemId:I,editCommentId:E,editComment:S,editAttachment:R,postComment:P,setIsPosting:L,setIsEditting:_,patchCommentCallback:J,postCommentCallback:V,exitEditMode:Y}),le=ae.state,re=ae.update,de=ae.imperativeHandle,se=ae.handleSendComment,ue=ae.handleKeyDown,ce=ae.handleSelectEmoji,pe=ae.handleAttachmentLoadingError,me=ae.handleFileUpload,he=ae.handleFileDelete,fe=ae.handleCancelClick;e.useImperativeHandle(n,(function(){return de}),[de]);var ge="".concat(l.get(te,["attributes","first_name"])||l.get(te,"first_name")," ").concat(l.get(te,["attributes","last_name"])||l.get(te,"last_name")),xe=le.isInputFocused||le.attachmentUrl||le.comment||S||(null==R?void 0:R.url);return v.jsxs("div",{style:M?A.commentTextFieldContainerSpaceAround:A.commentTextFieldContainer,children:[v.jsx("div",{style:A.chatAvatarWrapper,children:v.jsx(u.AvatarComponent,{displayName:ge,size:32,imgSrc:te&&te.profile_photo})}),v.jsx(o.Paper,{className:oe.paperRoot,children:v.jsx(o.TextField,{"data-testid":"".concat("commentInput","_input"),placeholder:"Type Comment",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:h,inputProps:{onChange:function(e){return re({comment:e})},singleLine:!0,value:le.comment||"",inputRef:a,withLightTheme:!1,onMount:z,companyId:$,autoFocus:O,disabled:W,onFocus:function(){return re({isInputFocused:!0})},onBlur:function(){return re({isInputFocused:!1})},allowSuggestionsAboveCursor:!0},endAdornment:!ie&&v.jsxs(o.InputAdornment,{position:"end",className:oe.inputAdornment,children:[!le.attachmentUrl&&v.jsx("div",{className:y.default(s.cCommentInputIconContainer,s.cCommentInputIconUpload),children:v.jsx(c.default,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:me,onError:pe,fileUploadIconClassName:oe.additionalActionButton,htmlColor:F.default[400],inputId:"comment-attachment-".concat(E||T),tooltipProps:{title:"Attach File",classes:{tooltip:oe.iconTooltip},placement:"top"}})}),v.jsx("div",{className:s.cCommentInputIconContainer,children:v.jsx(p,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:ce,emojiIconClassName:oe.additionalActionButton,htmlColor:F.default[400],disableRipple:!0,tooltipProps:{title:"Add Emoji",classes:{tooltip:oe.iconTooltip},placement:"top"}})})]}),disableUnderline:!0,classes:{root:oe.inputRoot,input:oe.inputEl}},className:oe.input,onKeyDown:ue})}),le.attachmentLoadingError&&v.jsx(m,{errorMessage:le.attachmentLoadingError,className:oe.fileUploadingError}),le.attachmentUrl&&v.jsx(f,{fileName:le.attachmentName,fileUrl:le.attachmentUrl,handleFileDelete:he,classes:oe}),v.jsx(o.Collapse,{in:xe,mountOnEnter:!0,unmountOnExit:!0,children:v.jsxs("div",{className:s.cCommentInputSendContainer,children:[v.jsx("div",{className:s.cCommentInputSendContainerCancel,children:v.jsx(o.Typography,{"data-testid":"".concat("commentInput","_cancel"),variant:"caption",className:y.default(oe.inputMain,oe.cancelText,oe.highlightedLabel),component:"div",gutterBottom:!0,onClick:fe,children:"Cancel"})}),v.jsxs("div",{className:s.cCommentInputSendContainerSend,children:[v.jsxs(o.Typography,{variant:"caption",className:y.default(oe.inputMain,oe.inputHelper),component:"div",gutterBottom:!0,children:["Press ",v.jsx(o.Typography,{variant:"caption",color:"primary",className:y.default(oe.inputMain,oe.highlightedLabel),children:"Enter"})," to send"]}),v.jsx(g,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:se,classes:{root:oe.sendButton},children:v.jsx(x,{})})]})]})})]})})),N={inputRef:j.default.shape({current:j.default.shape({focus:j.default.shape({})})}),editFeedItemId:j.default.number,editCommentId:j.default.number,editComment:j.default.string,editAttachment:j.default.shape({url:j.default.string,size:j.default.number,file_name:j.default.string}),spaceAround:j.default.bool,postComment:j.default.func.isRequired,postCommentCallback:j.default.func,patchCommentCallback:j.default.func,exitEditMode:j.default.func,setIsPosting:j.default.func,setIsEditting:j.default.func,onMount:j.default.func,autoFocus:j.default.bool,disabled:j.default.bool,classes:j.default.shape({}).isRequired,currentUser:j.default.shape(),isNative:j.default.bool,companyId:j.default.number,parentId:j.default.string};E.propTypes=N;var T=i.withStyles((function(e){return{paperRoot:{width:"calc(100% - 48px)",marginLeft:48,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(e.palette.primary.main)},boxShadow:"none",background:"#4D4D4D"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"8px",lineHeight:"29px",paddingLeft:"8px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"6px"},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:e.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:e.palette.primary.main},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}},inputAdornment:{marginBottom:"0!important",height:"100%"}}}))(e.memo(E));module.exports=T;
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/CommentInput/index.js"],"sourcesContent":["import { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\nimport noop from 'lodash/noop';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Collapse, Typography, TextField, InputAdornment, Paper } from '@material-ui/core';\nimport classNames from 'classnames';\nimport { get } from 'lodash';\nimport grey from '@material-ui/core/colors/grey';\n\nimport { patchFeedItemComment } from '../../clients/jsonApi';\n\nimport styles from './styles.css';\n\nimport Avatar from '~components/Avatar';\nimport FileUploadIconButton from '~components/FileUploadIconButton';\nimport EmojiIconButton from '~components/EmojiIconButton';\nimport FailedFileUploading from '~components/FailedFileUploading';\nimport UserMention from '~components/UserMention';\nimport FilePreview from '~components/FilePreview';\nimport IconButton from '~components/IconButton';\nimport SendIcon from '~components/Icons/SendIcon';\nimport { isSuggestionsListOpened } from '~components/UserMention/utils';\nimport utils from '~utils/main';\nimport { isNativeDetected } from '~/utils/mobileDetect';\nimport { notifyCommentEdit, notifyCommentPost } from '~utils/nativeMessages'; // question here\n\nconst PAGE_NAME = 'commentInput';\n\nconst INPUT_HEIGHT = 32;\nconst AVATAR_SIZE = 32;\n\nconst style = {\n chatAvatarWrapper: {\n display: 'flex',\n alignItems: 'center',\n position: 'absolute',\n left: 0,\n height: INPUT_HEIGHT,\n },\n commentTextFieldContainer: { position: 'relative', margin: '0' },\n commentTextFieldContainerSpaceAround: { position: 'relative', margin: '20px 10px' },\n};\n\nconst muiStyles = theme => ({\n paperRoot: {\n width: 'calc(100% - 48px)',\n marginLeft: AVATAR_SIZE + 16,\n display: 'inline-block',\n height: INPUT_HEIGHT,\n border: '0',\n '&:focus-within': {\n boxShadow: `inset 0 0 0 2px ${theme.palette.primary.main}`,\n },\n boxShadow: 'none',\n background: '#4D4D4D',\n },\n input: {\n paddingLeft: 5,\n width: '100%',\n },\n inputRoot: {\n height: INPUT_HEIGHT,\n paddingRight: '8px',\n lineHeight: '29px',\n paddingLeft: '8px',\n },\n inputEl: { padding: '0 0 0 6px', height: '100%' },\n additionalActionButton: {\n padding: '6px',\n },\n nativeActionButton: {\n margin: '5px 10px',\n cursor: 'pointer',\n },\n fileUploadingError: {\n marginTop: 10,\n marginLeft: 24,\n },\n inputMain: {\n marginBottom: 0,\n fontSize: '11px',\n color: theme.palette.primary.text8,\n },\n inputHelper: {\n display: 'flex',\n paddingRight: 5,\n },\n cancelText: {\n cursor: 'pointer',\n },\n highlightedLabel: {\n color: theme.palette.primary.main,\n },\n iconTooltip: {\n marginTop: '3px',\n },\n sendButton: {\n '&:hover': {\n backgroundColor: 'rgba(3,188,212, 0.1)',\n },\n '&.MuiButtonBase-root': {\n padding: 7,\n },\n },\n inputAdornment: {\n marginBottom: '0!important',\n height: '100%',\n },\n});\n\nclass CommentInput extends PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n\n attachmentLoadingError: null,\n isInputFocused: false,\n };\n }\n\n componentDidMount() {\n if (this.isEditMode) {\n this.setInitialCommentValue();\n }\n }\n\n componentDidUpdate(prevProps) {\n const enteredEditMode = this.isEditMode && !prevProps.editFeedItemId;\n if (\n enteredEditMode ||\n (this.props.editCommentId && this.props.editCommentId !== prevProps.editCommentId)\n ) {\n this.setInitialCommentValue();\n }\n }\n\n get isEditMode() {\n return !!this.props.editFeedItemId;\n }\n\n setInitialCommentValue() {\n const attachmentUrl = this.props.editAttachment ? this.props.editAttachment.url : null;\n\n this.setState({\n comment: this.props.editComment,\n attachmentUrl,\n attachmentName: attachmentUrl\n ? this.props.editAttachment.file_name ||\n utils.getFileNameWithExtensionFromPath(attachmentUrl)\n : null,\n attachmentSize: this.props.editAttachment ? this.props.editAttachment.size : null,\n });\n }\n\n handleSelectEmoji = emoji =>\n this.setState(({ comment }) => ({ comment: `${comment}${emoji.native}` }));\n\n postComment = async comment => {\n let commentResponse;\n try {\n commentResponse = await this.props.postComment(comment);\n } catch (e) {\n console.error(e.message);\n }\n\n return commentResponse;\n };\n\n patchComment = async comment => {\n const { editFeedItemId, editCommentId } = this.props;\n\n let commentResponse;\n\n try {\n commentResponse = await patchFeedItemComment(editFeedItemId, editCommentId, comment);\n } catch (e) {\n console.error(e.message);\n }\n\n return commentResponse;\n };\n\n focusOnRef() {\n if (this.props.inputRef) this.props.inputRef.current.focus();\n }\n\n clearCommentField = callback => {\n this.setState(\n {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n },\n () => {\n this.focusOnRef();\n if (callback && typeof callback === 'function') callback();\n }\n );\n };\n\n handleKeyDown = event => {\n const { key } = event;\n\n if (key === 'Escape') this.props.exitEditMode();\n\n if (key === 'Enter') {\n if (!isSuggestionsListOpened()) {\n event.preventDefault();\n this.handleSendComment();\n }\n }\n };\n\n handleAttachmentLoadingError = attachmentLoadingError => {\n this.setState({\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n attachmentLoadingError,\n });\n };\n\n handleFileUpload = (attachmentUrl, attachmentName, attachmentSize) => {\n this.setState({\n attachmentUrl,\n attachmentName,\n attachmentSize,\n attachmentLoadingError: null,\n });\n };\n\n handleNativeFileUpload = () => {\n const { comment } = this.state;\n\n if (this.isEditMode) {\n notifyCommentEdit(comment);\n this.clearCommentField(this.props.exitEditMode);\n } else {\n notifyCommentPost(comment);\n this.clearCommentField();\n }\n };\n\n handleFileDelete = () =>\n this.setState({ attachmentUrl: null, attachmentName: null, attachmentSize: null });\n\n handleSendComment = async () => {\n const textComment = this.state.comment ? this.state.comment.trim() : null;\n if (!textComment && !this.state.attachmentUrl) return;\n\n const comment = {\n comment: {\n body: textComment,\n attachment: {\n url: this.state.attachmentUrl,\n size: this.state.attachmentSize,\n file_name: this.state.attachmentName,\n },\n },\n };\n\n let commentResponse;\n\n if (this.isEditMode) {\n this.props.setIsEditting(true);\n\n commentResponse = await this.patchComment(comment);\n await this.props.patchCommentCallback(commentResponse);\n\n this.props.setIsEditting(false);\n this.clearCommentField();\n this.props.exitEditMode();\n } else {\n this.props.setIsPosting(true);\n\n commentResponse = await this.postComment(comment);\n await this.props.postCommentCallback(commentResponse);\n\n this.props.setIsPosting(false);\n this.clearCommentField();\n }\n };\n\n handleCancelClick = () => {\n this.setState(\n {\n comment: '',\n attachmentUrl: null,\n attachmentName: null,\n attachmentSize: null,\n },\n this.props.exitEditMode()\n );\n };\n\n render() {\n const { classes, currentUser } = this.props;\n\n const currentUserFullName = `${\n get(currentUser, ['attributes', 'first_name']) || get(currentUser, 'first_name')\n } ${get(currentUser, ['attributes', 'last_name']) || get(currentUser, 'last_name')}`;\n\n const isVisibleActionBar =\n this.state.isInputFocused ||\n this.state.attachmentUrl ||\n this.state.comment ||\n this.props.editComment ||\n this.props.editAttachment?.url;\n\n return (\n <div\n style={\n this.props.spaceAround\n ? style.commentTextFieldContainerSpaceAround\n : style.commentTextFieldContainer\n }\n >\n <div style={style.chatAvatarWrapper}>\n <Avatar\n displayName={currentUserFullName}\n size={AVATAR_SIZE}\n imgSrc={this.props.currentUser && this.props.currentUser.profile_photo}\n />\n </div>\n <Paper className={this.props.classes.paperRoot}>\n <TextField\n data-testid={`${PAGE_NAME}_input`}\n placeholder=\"Type Comment\"\n FormHelperTextProps={{\n component: 'div',\n margin: 'dense',\n }}\n InputProps={{\n inputComponent: UserMention,\n inputProps: {\n onChange: comment => this.setState({ comment }),\n singleLine: true,\n value: this.state.comment || '',\n inputRef: this.props.inputRef,\n withLightTheme: false,\n onMount: this.props.onMount,\n companyId: this.props.companyId,\n autoFocus: this.props.autoFocus,\n disabled: this.props.disabled,\n onFocus: () => this.setState({ isInputFocused: true }),\n onBlur: () => this.setState({ isInputFocused: false }),\n allowSuggestionsAboveCursor: true,\n },\n endAdornment: !this.props.isNative && (\n <InputAdornment position=\"end\" className={this.props.classes.inputAdornment}>\n {!this.state.attachmentUrl && (\n <div\n className={classNames(\n styles.cCommentInputIconContainer,\n styles.cCommentInputIconUpload\n )}\n >\n <FileUploadIconButton\n openPreviewDialogOnUpload={false}\n disableRipple\n onFinish={this.handleFileUpload}\n onError={this.handleAttachmentLoadingError}\n fileUploadIconClassName={this.props.classes.additionalActionButton}\n htmlColor={grey[400]}\n inputId={`comment-attachment-${\n this.props.editCommentId || this.props.parentId\n }`}\n tooltipProps={{\n title: 'Attach File',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n )}\n <div className={styles.cCommentInputIconContainer}>\n <EmojiIconButton\n data-testid={`${PAGE_NAME}_emojiButton`}\n handleSelectEmoji={this.handleSelectEmoji}\n emojiIconClassName={this.props.classes.additionalActionButton}\n htmlColor={grey[400]}\n disableRipple\n tooltipProps={{\n title: 'Add Emoji',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n </InputAdornment>\n ),\n disableUnderline: true,\n classes: {\n root: this.props.classes.inputRoot,\n input: this.props.classes.inputEl,\n },\n }}\n className={this.props.classes.input}\n onKeyDown={this.handleKeyDown}\n />\n </Paper>\n\n {this.state.attachmentLoadingError && (\n <FailedFileUploading\n errorMessage={this.state.attachmentLoadingError}\n className={this.props.classes.fileUploadingError}\n />\n )}\n\n {this.state.attachmentUrl && (\n <FilePreview\n fileName={this.state.attachmentName}\n fileUrl={this.state.attachmentUrl}\n handleFileDelete={this.handleFileDelete}\n classes={this.props.classes}\n />\n )}\n <Collapse in={isVisibleActionBar} mountOnEnter unmountOnExit>\n <div className={styles.cCommentInputSendContainer}>\n <div className={styles.cCommentInputSendContainerCancel}>\n <Typography\n data-testid={`${PAGE_NAME}_cancel`}\n variant=\"caption\"\n className={classNames(\n this.props.classes.inputMain,\n this.props.classes.cancelText,\n this.props.classes.highlightedLabel\n )}\n component=\"div\"\n gutterBottom\n onClick={this.handleCancelClick}\n >\n Cancel\n </Typography>\n </div>\n <div className={styles.cCommentInputSendContainerSend}>\n <Typography\n variant=\"caption\"\n className={classNames(this.props.classes.inputMain, this.props.classes.inputHelper)}\n component=\"div\"\n gutterBottom\n >\n Press&nbsp;\n <Typography\n variant=\"caption\"\n color=\"primary\"\n className={classNames(\n this.props.classes.inputMain,\n this.props.classes.highlightedLabel\n )}\n >\n Enter\n </Typography>\n &nbsp;to send\n </Typography>\n <IconButton\n size=\"large\"\n tooltipProps={{ title: 'Send' }}\n data-testid={`${PAGE_NAME}_sendButton`}\n onClick={this.handleSendComment}\n classes={{ root: this.props.classes.sendButton }}\n >\n <SendIcon />\n </IconButton>\n </div>\n </div>\n </Collapse>\n </div>\n );\n }\n}\n\nCommentInput.propTypes = {\n inputRef: PropTypes.shape({ current: PropTypes.shape({ focus: PropTypes.shape({}) }) }),\n editFeedItemId: PropTypes.number,\n editCommentId: PropTypes.number,\n editComment: PropTypes.string,\n editAttachment: PropTypes.shape({\n url: PropTypes.string,\n size: PropTypes.number,\n file_name: PropTypes.string,\n }),\n spaceAround: PropTypes.bool,\n postComment: PropTypes.func.isRequired,\n postCommentCallback: PropTypes.func,\n patchCommentCallback: PropTypes.func,\n exitEditMode: PropTypes.func,\n setIsPosting: PropTypes.func,\n setIsEditting: PropTypes.func,\n onMount: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n classes: PropTypes.shape({}).isRequired,\n\n currentUser: PropTypes.shape(),\n isNative: PropTypes.bool,\n companyId: PropTypes.number,\n parentId: PropTypes.string,\n};\n\nCommentInput.defaultProps = {\n inputRef: null,\n editFeedItemId: null,\n editCommentId: null,\n parentId: null,\n editComment: null,\n editAttachment: {},\n spaceAround: false,\n setIsPosting: noop,\n setIsEditting: noop,\n onMount: noop,\n autoFocus: undefined,\n disabled: false,\n patchCommentCallback: noop,\n postCommentCallback: noop,\n exitEditMode: noop,\n companyId: null,\n currentUser: {},\n\n isNative: isNativeDetected,\n};\n\nexport default withStyles(muiStyles)(CommentInput);\n"],"names":["style","chatAvatarWrapper","display","alignItems","position","left","height","commentTextFieldContainer","margin","commentTextFieldContainerSpaceAround","CommentInput","_PureComponent","_inherits","_super","_createSuper","props","_this","_ref2","_ref3","_classCallCheck","this","call","_defineProperty","_assertThisInitialized","emoji","setState","_ref","comment","native","_asyncToGenerator","_regeneratorRuntime","mark","commentResponse","wrap","_context","prev","next","postComment","sent","t0","console","error","message","abrupt","stop","_callee","_x","apply","arguments","_this$props","editFeedItemId","editCommentId","_context2","patchFeedItemComment","_callee2","_x2","callback","attachmentUrl","attachmentName","attachmentSize","focusOnRef","event","key","exitEditMode","isSuggestionsListOpened","preventDefault","handleSendComment","attachmentLoadingError","state","isEditMode","notifyCommentEdit","clearCommentField","notifyCommentPost","_callee3","textComment","_context3","trim","body","attachment","url","size","file_name","setIsEditting","patchComment","patchCommentCallback","setIsPosting","postCommentCallback","isInputFocused","_createClass","value","setInitialCommentValue","prevProps","get","editAttachment","editComment","utils","getFileNameWithExtensionFromPath","inputRef","current","focus","_this$props$editAttac","_this2","_this$props2","classes","currentUser","currentUserFullName","concat","isVisibleActionBar","_jsxs","spaceAround","children","_jsx","jsx","Avatar","displayName","imgSrc","profile_photo","Paper","className","paperRoot","TextField","placeholder","FormHelperTextProps","component","InputProps","inputComponent","UserMention","inputProps","onChange","singleLine","withLightTheme","onMount","companyId","autoFocus","disabled","onFocus","onBlur","allowSuggestionsAboveCursor","endAdornment","isNative","InputAdornment","inputAdornment","classNames","styles","cCommentInputIconContainer","cCommentInputIconUpload","FileUploadIconButton","openPreviewDialogOnUpload","disableRipple","onFinish","handleFileUpload","onError","handleAttachmentLoadingError","fileUploadIconClassName","additionalActionButton","htmlColor","grey","inputId","parentId","tooltipProps","title","tooltip","iconTooltip","placement","EmojiIconButton","handleSelectEmoji","emojiIconClassName","disableUnderline","root","inputRoot","input","inputEl","onKeyDown","handleKeyDown","FailedFileUploading","errorMessage","fileUploadingError","FilePreview","fileName","fileUrl","handleFileDelete","Collapse","in","mountOnEnter","unmountOnExit","jsxs","cCommentInputSendContainer","cCommentInputSendContainerCancel","Typography","variant","inputMain","cancelText","highlightedLabel","gutterBottom","onClick","handleCancelClick","cCommentInputSendContainerSend","inputHelper","color","IconButton","sendButton","SendIcon","PureComponent","propTypes","PropTypes","shape","number","string","bool","func","isRequired","defaultProps","noop","undefined","isNativeDetected","CommentInput$1","withStyles","theme","width","marginLeft","AVATAR_SIZE","border","boxShadow","palette","primary","main","background","paddingLeft","paddingRight","lineHeight","padding","nativeActionButton","cursor","marginTop","marginBottom","fontSize","text8","backgroundColor"],"mappings":"40DA0BA,IAKMA,EAAQ,CACZC,kBAAmB,CACjBC,QAAS,OACTC,WAAY,SACZC,SAAU,WACVC,KAAM,EACNC,OATiB,IAWnBC,0BAA2B,CAAEH,SAAU,WAAYI,OAAQ,KAC3DC,qCAAsC,CAAEL,SAAU,WAAYI,OAAQ,cAsElEE,EAAY,SAAAC,GAAAC,UAAAF,EAAAC,GAAA,IAAAE,EAAAC,EAAAJ,GAChB,SAAAA,EAAYK,GAAO,IAAAC,EAiDyDC,EAW3EC,EAjDG,OAXeC,UAAAC,KAAAV,GACjBM,EAAAH,EAAAQ,KAAAD,KAAML,GAAOO,EAAAA,QAAAC,EAAAA,QAAAP,GAAA,qBA+CK,SAAAQ,GAAK,OACvBR,EAAKS,UAAS,SAAAC,GAAA,IAAGC,IAAAA,QAAO,MAAQ,CAAEA,QAAYA,GAAAA,OAAAA,GAAUH,OAAAA,EAAMI,QAAU,GAAE,IAAAN,EAAAA,QAAAC,EAAA,QAAAP,GAAA,eAAAC,EAAAY,EAAAA,QAAAC,EAAAA,QAAAC,MAE9D,WAAMJ,GAAO,IAAAK,EAAA,OAAAF,UAAA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AAa,EACbT,MAAO,QAETjD,UAAW,CACTnK,OAjCiB,GAkCjB8N,aAAc,MACdC,WAAY,OACZF,YAAa,OAEfxD,QAAS,CAAE2D,QAAS,YAAahO,OAAQ,QACzCoJ,uBAAwB,CACtB4E,QAAS,OAEXC,mBAAoB,CAClB/N,OAAQ,WACRgO,OAAQ,WAEVxD,mBAAoB,CAClByD,UAAW,GACXd,WAAY,IAEd7B,UAAW,CACT4C,aAAc,EACdC,SAAU,OACVrC,MAAOmB,EAAMM,QAAQC,QAAQY,OAE/BvC,YAAa,CACXnM,QAAS,OACTkO,aAAc,GAEhBrC,WAAY,CACVyC,OAAQ,WAEVxC,iBAAkB,CAChBM,MAAOmB,EAAMM,QAAQC,QAAQC,MAE/B/D,YAAa,CACXuE,UAAW,OAEbjC,WAAY,CACV,UAAW,CACTqC,gBAAiB,wBAEnB,uBAAwB,CACtBP,QAAS,IAGbzF,eAAgB,CACd6F,aAAc,cACdpO,OAAQ,QAEX,GAqackN,CAAsB9M"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/CommentInput/index.js"],"sourcesContent":["import { forwardRef, memo, useImperativeHandle } from 'react';\nimport PropTypes from 'prop-types';\nimport noop from 'lodash/noop';\nimport { withStyles } from '@material-ui/core/styles';\nimport { Collapse, Typography, TextField, InputAdornment, Paper } from '@material-ui/core';\nimport classNames from 'classnames';\nimport { get } from 'lodash';\nimport grey from '@material-ui/core/colors/grey';\n\nimport useCommentInput from './useCommentInput';\n\nimport styles from './styles.css';\n\nimport Avatar from '~components/Avatar';\nimport FileUploadIconButton from '~components/FileUploadIconButton';\nimport EmojiIconButton from '~components/EmojiIconButton';\nimport FailedFileUploading from '~components/FailedFileUploading';\nimport UserMention from '~components/UserMention';\nimport FilePreview from '~components/FilePreview';\nimport IconButton from '~components/IconButton';\nimport SendIcon from '~components/Icons/SendIcon';\nimport { isNativeDetected } from '~/utils/mobileDetect';\n\nconst PAGE_NAME = 'commentInput';\n\nconst INPUT_HEIGHT = 32;\nconst AVATAR_SIZE = 32;\n\nconst style = {\n chatAvatarWrapper: {\n display: 'flex',\n alignItems: 'center',\n position: 'absolute',\n left: 0,\n height: INPUT_HEIGHT,\n },\n commentTextFieldContainer: { position: 'relative', margin: '0' },\n commentTextFieldContainerSpaceAround: { position: 'relative', margin: '20px 10px' },\n};\n\nconst muiStyles = theme => ({\n paperRoot: {\n width: 'calc(100% - 48px)',\n marginLeft: AVATAR_SIZE + 16,\n display: 'inline-block',\n height: INPUT_HEIGHT,\n border: '0',\n '&:focus-within': {\n boxShadow: `inset 0 0 0 2px ${theme.palette.primary.main}`,\n },\n boxShadow: 'none',\n background: '#4D4D4D',\n },\n input: {\n paddingLeft: 5,\n width: '100%',\n },\n inputRoot: {\n height: INPUT_HEIGHT,\n paddingRight: '8px',\n lineHeight: '29px',\n paddingLeft: '8px',\n },\n inputEl: { padding: '0 0 0 6px', height: '100%' },\n additionalActionButton: {\n padding: '6px',\n },\n nativeActionButton: {\n margin: '5px 10px',\n cursor: 'pointer',\n },\n fileUploadingError: {\n marginTop: 10,\n marginLeft: 24,\n },\n inputMain: {\n marginBottom: 0,\n fontSize: '11px',\n color: theme.palette.primary.text8,\n },\n inputHelper: {\n display: 'flex',\n paddingRight: 5,\n },\n cancelText: {\n cursor: 'pointer',\n },\n highlightedLabel: {\n color: theme.palette.primary.main,\n },\n iconTooltip: {\n marginTop: '3px',\n },\n sendButton: {\n '&:hover': {\n backgroundColor: 'rgba(3,188,212, 0.1)',\n },\n '&.MuiButtonBase-root': {\n padding: 7,\n },\n },\n inputAdornment: {\n marginBottom: '0!important',\n height: '100%',\n },\n});\n\nconst emptyObject = {};\n\nconst CommentInput = forwardRef(\n /** @param {PropTypes.InferProps<typeof propTypes>} props */ function CommentInput(\n {\n inputRef = null,\n editFeedItemId = null,\n editCommentId = null,\n parentId = null,\n editComment = null,\n editAttachment = emptyObject,\n spaceAround = false,\n postComment,\n setIsPosting = noop,\n setIsEditting = noop,\n onMount = noop,\n autoFocus,\n disabled = false,\n patchCommentCallback = noop,\n postCommentCallback = noop,\n exitEditMode = noop,\n companyId = null,\n currentUser = emptyObject,\n isNative = isNativeDetected,\n classes,\n },\n ref\n ) {\n const {\n state,\n update,\n imperativeHandle,\n handleSendComment,\n handleKeyDown,\n handleSelectEmoji,\n handleAttachmentLoadingError,\n handleFileUpload,\n handleFileDelete,\n handleCancelClick,\n } = useCommentInput({\n inputRef,\n editFeedItemId,\n editCommentId,\n editComment,\n editAttachment,\n postComment,\n setIsPosting,\n setIsEditting,\n patchCommentCallback,\n postCommentCallback,\n exitEditMode,\n });\n useImperativeHandle(ref, () => imperativeHandle, [imperativeHandle]);\n\n const currentUserFullName = `${\n get(currentUser, ['attributes', 'first_name']) || get(currentUser, 'first_name')\n } ${get(currentUser, ['attributes', 'last_name']) || get(currentUser, 'last_name')}`;\n\n const isVisibleActionBar =\n state.isInputFocused ||\n state.attachmentUrl ||\n state.comment ||\n editComment ||\n editAttachment?.url;\n\n return (\n <div\n style={\n spaceAround ? style.commentTextFieldContainerSpaceAround : style.commentTextFieldContainer\n }\n >\n <div style={style.chatAvatarWrapper}>\n <Avatar\n displayName={currentUserFullName}\n size={AVATAR_SIZE}\n imgSrc={currentUser && currentUser.profile_photo}\n />\n </div>\n <Paper className={classes.paperRoot}>\n <TextField\n data-testid={`${PAGE_NAME}_input`}\n placeholder=\"Type Comment\"\n FormHelperTextProps={{\n component: 'div',\n margin: 'dense',\n }}\n InputProps={{\n inputComponent: UserMention,\n inputProps: {\n onChange: comment => update({ comment }),\n singleLine: true,\n value: state.comment || '',\n inputRef: inputRef,\n withLightTheme: false,\n onMount: onMount,\n companyId: companyId,\n autoFocus: autoFocus,\n disabled: disabled,\n onFocus: () => update({ isInputFocused: true }),\n onBlur: () => update({ isInputFocused: false }),\n allowSuggestionsAboveCursor: true,\n },\n endAdornment: !isNative && (\n <InputAdornment position=\"end\" className={classes.inputAdornment}>\n {!state.attachmentUrl && (\n <div\n className={classNames(\n styles.cCommentInputIconContainer,\n styles.cCommentInputIconUpload\n )}\n >\n <FileUploadIconButton\n openPreviewDialogOnUpload={false}\n disableRipple\n onFinish={handleFileUpload}\n onError={handleAttachmentLoadingError}\n fileUploadIconClassName={classes.additionalActionButton}\n htmlColor={grey[400]}\n inputId={`comment-attachment-${editCommentId || parentId}`}\n tooltipProps={{\n title: 'Attach File',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n )}\n <div className={styles.cCommentInputIconContainer}>\n <EmojiIconButton\n data-testid={`${PAGE_NAME}_emojiButton`}\n handleSelectEmoji={handleSelectEmoji}\n emojiIconClassName={classes.additionalActionButton}\n htmlColor={grey[400]}\n disableRipple\n tooltipProps={{\n title: 'Add Emoji',\n classes: { tooltip: classes.iconTooltip },\n placement: 'top',\n }}\n />\n </div>\n </InputAdornment>\n ),\n disableUnderline: true,\n classes: {\n root: classes.inputRoot,\n input: classes.inputEl,\n },\n }}\n className={classes.input}\n onKeyDown={handleKeyDown}\n />\n </Paper>\n\n {state.attachmentLoadingError && (\n <FailedFileUploading\n errorMessage={state.attachmentLoadingError}\n className={classes.fileUploadingError}\n />\n )}\n\n {state.attachmentUrl && (\n <FilePreview\n fileName={state.attachmentName}\n fileUrl={state.attachmentUrl}\n handleFileDelete={handleFileDelete}\n classes={classes}\n />\n )}\n <Collapse in={isVisibleActionBar} mountOnEnter unmountOnExit>\n <div className={styles.cCommentInputSendContainer}>\n <div className={styles.cCommentInputSendContainerCancel}>\n <Typography\n data-testid={`${PAGE_NAME}_cancel`}\n variant=\"caption\"\n className={classNames(\n classes.inputMain,\n classes.cancelText,\n classes.highlightedLabel\n )}\n component=\"div\"\n gutterBottom\n onClick={handleCancelClick}\n >\n Cancel\n </Typography>\n </div>\n <div className={styles.cCommentInputSendContainerSend}>\n <Typography\n variant=\"caption\"\n className={classNames(classes.inputMain, classes.inputHelper)}\n component=\"div\"\n gutterBottom\n >\n Press&nbsp;\n <Typography\n variant=\"caption\"\n color=\"primary\"\n className={classNames(classes.inputMain, classes.highlightedLabel)}\n >\n Enter\n </Typography>\n &nbsp;to send\n </Typography>\n <IconButton\n size=\"large\"\n tooltipProps={{ title: 'Send' }}\n data-testid={`${PAGE_NAME}_sendButton`}\n onClick={handleSendComment}\n classes={{ root: classes.sendButton }}\n >\n <SendIcon />\n </IconButton>\n </div>\n </div>\n </Collapse>\n </div>\n );\n }\n);\n\nconst propTypes = {\n inputRef: PropTypes.shape({ current: PropTypes.shape({ focus: PropTypes.shape({}) }) }),\n editFeedItemId: PropTypes.number,\n editCommentId: PropTypes.number,\n editComment: PropTypes.string,\n editAttachment: PropTypes.shape({\n url: PropTypes.string,\n size: PropTypes.number,\n file_name: PropTypes.string,\n }),\n spaceAround: PropTypes.bool,\n postComment: PropTypes.func.isRequired,\n postCommentCallback: PropTypes.func,\n patchCommentCallback: PropTypes.func,\n exitEditMode: PropTypes.func,\n setIsPosting: PropTypes.func,\n setIsEditting: PropTypes.func,\n onMount: PropTypes.func,\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n\n classes: PropTypes.shape({}).isRequired,\n\n currentUser: PropTypes.shape(),\n isNative: PropTypes.bool,\n companyId: PropTypes.number,\n parentId: PropTypes.string,\n};\n\nCommentInput.propTypes = propTypes;\n\nexport default withStyles(muiStyles)(memo(CommentInput));\n"],"names":["style","chatAvatarWrapper","display","alignItems","position","left","height","commentTextFieldContainer","margin","commentTextFieldContainerSpaceAround","emptyObject","CommentInput","forwardRef","ref","_ref$inputRef","_ref","inputRef","_ref$editFeedItemId","editFeedItemId","_ref$editCommentId","editCommentId","_ref$parentId","parentId","_ref$editComment","editComment","_ref$editAttachment","editAttachment","_ref$spaceAround","spaceAround","postComment","_ref$setIsPosting","setIsPosting","noop","_ref$setIsEditting","setIsEditting","_ref$onMount","onMount","autoFocus","_ref$disabled","disabled","_ref$patchCommentCall","patchCommentCallback","_ref$postCommentCallb","postCommentCallback","_ref$exitEditMode","exitEditMode","_ref$companyId","companyId","_ref$currentUser","currentUser","_ref$isNative","isNative","isNativeDetected","classes","_useCommentInput","useCommentInput","state","update","imperativeHandle","handleSendComment","handleKeyDown","handleSelectEmoji","handleAttachmentLoadingError","handleFileUpload","handleFileDelete","handleCancelClick","useImperativeHandle","currentUserFullName","get","concat","isVisibleActionBar","isInputFocused","attachmentUrl","comment","url","_jsxs","children","_jsx","jsx","Avatar","displayName","size","imgSrc","profile_photo","Paper","className","paperRoot","TextField","placeholder","FormHelperTextProps","component","InputProps","inputComponent","UserMention","inputProps","onChange","singleLine","value","withLightTheme","onFocus","onBlur","allowSuggestionsAboveCursor","endAdornment","InputAdornment","inputAdornment","classNames","styles","cCommentInputIconContainer","cCommentInputIconUpload","FileUploadIconButton","openPreviewDialogOnUpload","disableRipple","onFinish","onError","fileUploadIconClassName","additionalActionButton","htmlColor","grey","inputId","tooltipProps","title","tooltip","iconTooltip","placement","EmojiIconButton","emojiIconClassName","disableUnderline","root","inputRoot","input","inputEl","onKeyDown","attachmentLoadingError","FailedFileUploading","errorMessage","fileUploadingError","FilePreview","fileName","attachmentName","fileUrl","Collapse","in","mountOnEnter","unmountOnExit","jsxs","cCommentInputSendContainer","cCommentInputSendContainerCancel","Typography","variant","inputMain","cancelText","highlightedLabel","gutterBottom","onClick","cCommentInputSendContainerSend","inputHelper","color","IconButton","sendButton","SendIcon","propTypes","PropTypes","shape","current","focus","number","string","file_name","bool","func","isRequired","withStyles","theme","width","marginLeft","AVATAR_SIZE","border","boxShadow","palette","primary","main","background","paddingLeft","paddingRight","lineHeight","padding","nativeActionButton","cursor","marginTop","marginBottom","fontSize","text8","backgroundColor","memo"],"mappings":"kwBA4BMA,EAAQ,CACZC,kBAAmB,CACjBC,QAAS,OACTC,WAAY,SACZC,SAAU,WACVC,KAAM,EACNC,OATiB,IAWnBC,0BAA2B,CAAEH,SAAU,WAAYI,OAAQ,KAC3DC,qCAAsC,CAAEL,SAAU,WAAYI,OAAQ,cAsElEE,EAAc,CAAA,EAEdC,EAAeC,EAAAA,YAC0C,SAuB3D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S,QAACC,MAAM,CAAA,GAAIQ,WAE7BzH,YAAagH,EAAS,QAACC,QACvB/G,SAAU8G,EAAS,QAACO,KACpBzH,UAAWkH,EAAS,QAACI,OACrB/I,SAAU2I,EAAS,QAACK,QAGtB3J,EAAaqJ,UAAYA,EAEzB,IAAeW,EAAAA,EAAAA,YA/TG,SAAAC,GAAK,MAAK,CAC1BtF,UAAW,CACTuF,MAAO,oBACPC,WAAYC,GACZ7K,QAAS,eACTI,OApBiB,GAqBjB0K,OAAQ,IACR,iBAAkB,CAChBC,oCAA8BL,EAAMM,QAAQC,QAAQC,OAEtDH,UAAW,OACXI,WAAY,WAEdpD,MAAO,CACLqD,YAAa,EACbT,MAAO,QAET7C,UAAW,CACT1H,OAjCiB,GAkCjBiL,aAAc,MACdC,WAAY,OACZF,YAAa,OAEfpD,QAAS,CAAEuD,QAAS,YAAanL,OAAQ,QACzC6G,uBAAwB,CACtBsE,QAAS,OAEXC,mBAAoB,CAClBlL,OAAQ,WACRmL,OAAQ,WAEVpD,mBAAoB,CAClBqD,UAAW,GACXd,WAAY,IAEdzB,UAAW,CACTwC,aAAc,EACdC,SAAU,OACVlC,MAAOgB,EAAMM,QAAQC,QAAQY,OAE/BpC,YAAa,CACXzJ,QAAS,OACTqL,aAAc,GAEhBjC,WAAY,CACVqC,OAAQ,WAEVpC,iBAAkB,CAChBK,MAAOgB,EAAMM,QAAQC,QAAQC,MAE/B1D,YAAa,CACXkE,UAAW,OAEb9B,WAAY,CACV,UAAW,CACTkC,gBAAiB,wBAEnB,uBAAwB,CACtBP,QAAS,IAGbjF,eAAgB,CACdqF,aAAc,cACdvL,OAAQ,QAEX,GA8PcqK,CAAsBsB,EAAIA,KAACtL"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/helpers/defineProperty"),n=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/regenerator"),a=require("react"),c=require("../../clients/jsonApi/index.js"),u=require("../UserMention/utils/index.js"),o=require("../../utils/main.js"),i=require("../../utils/nativeMessages.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=s(e),m=s(t),p=s(n),d=s(r);function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){m.default(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var b={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null};module.exports=function(e){var t=a.useState(h(h({},b),{},{attachmentLoadingError:null,isInputFocused:!1})),n=p.default(t,2),r=n[0],s=n[1],m=a.useRef({props:e,state:r}),f=a.useRef(null),v=a.useRef([]),y=a.useCallback((function(e){return s((function(t){return h(h({},t),e)}))}),[]),C=function(){m.current.props.inputRef&&m.current.props.inputRef.current.focus()},I=function(){var e=m.current.props,t=e.editAttachment?e.editAttachment.url:null;y({comment:e.editComment,attachmentUrl:t,attachmentName:t?e.editAttachment.file_name||o.default.getFileNameWithExtensionFromPath(t):null,attachmentSize:e.editAttachment?e.editAttachment.size:null})};a.useLayoutEffect((function(){m.current={props:e,state:r};var t=f.current;f.current=e,(!t&&e.editFeedItemId||e.editFeedItemId&&t&&!t.editFeedItemId||t&&e.editCommentId&&e.editCommentId!==t.editCommentId)&&I();var n=v.current;v.current=[],n.forEach((function(e){var t=e.focus,n=e.callback;t&&C(),"function"==typeof n&&n()}))}));var g,k=function(e){v.current.push({focus:!0,callback:e}),y(b)},E=(g=l.default(d.default.mark((function e(){var t,n,r,a,u,o,i;return d.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=m.current,(n=t.state.comment?t.state.comment.trim():null)||t.state.attachmentUrl){e.next=4;break}return e.abrupt("return");case 4:if(r={comment:{body:n,attachment:{url:t.state.attachmentUrl,size:t.state.attachmentSize,file_name:t.state.attachmentName}}},!t.props.editFeedItemId){e.next=24;break}return t.props.setIsEditting(!0),e.prev=7,u=m.current.props,o=u.editFeedItemId,i=u.editCommentId,e.next=11,c.patchFeedItemComment(o,i,r);case 11:a=e.sent,e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),console.error(e.t0.message);case 17:return e.next=19,m.current.props.patchCommentCallback(a);case 19:m.current.props.setIsEditting(!1),k(),m.current.props.exitEditMode(),e.next=38;break;case 24:return t.props.setIsPosting(!0),e.prev=25,e.next=28,m.current.props.postComment(r);case 28:a=e.sent,e.next=34;break;case 31:e.prev=31,e.t1=e.catch(25),console.error(e.t1.message);case 34:return e.next=36,m.current.props.postCommentCallback(a);case 36:m.current.props.setIsPosting(!1),k();case 38:case"end":return e.stop()}}),e,null,[[7,14],[25,31]])}))),function(){return g.apply(this,arguments)}),O=a.useRef({clearCommentField:k,focusOnRef:C,setInitialCommentValue:I,handleNativeFileUpload:function(){var e=m.current;e.props.editFeedItemId?(i.notifyCommentEdit(e.state.comment),k(m.current.props.exitEditMode)):(i.notifyCommentPost(e.state.comment),k())},handleSendComment:E}),j=a.useCallback((function(e){return s((function(t){return h(h({},t),{},{comment:"".concat(t.comment).concat(e.native)})}))}),[]),x=a.useCallback((function(e){return y({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:e})}),[y]),F=a.useCallback((function(e,t,n){return y({attachmentUrl:e,attachmentName:t,attachmentSize:n,attachmentLoadingError:null})}),[y]);return{state:r,update:y,imperativeHandle:O.current,handleSendComment:E,handleKeyDown:function(e){"Escape"===e.key&&m.current.props.exitEditMode(),"Enter"!==e.key||u.isSuggestionsListOpened()||(e.preventDefault(),E())},handleSelectEmoji:j,handleAttachmentLoadingError:x,handleFileUpload:F,handleFileDelete:function(){return y({attachmentUrl:null,attachmentName:null,attachmentSize:null})},handleCancelClick:function(){var e=m.current.props.exitEditMode();"function"==typeof e&&v.current.push({callback:e}),y(b)}}};
2
+ //# sourceMappingURL=useCommentInput.js.map