@corva/ui 0.35.0-14 → 0.35.0-15
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/slicedToArray";import o from"@babel/runtime/helpers/defineProperty";import{useState as r,useRef as
|
|
1
|
+
import e from"@babel/runtime/helpers/slicedToArray";import o from"@babel/runtime/helpers/defineProperty";import{useState as r,useRef as t,useEffect as n}from"react";import a from"prop-types";import i from"classnames";import{noop as l}from"lodash";import{makeStyles as c,Drawer as p,Box as d,Tooltip as s}from"@material-ui/core";import h from"@material-ui/icons/ChevronLeftRounded";import m from"@material-ui/icons/ChevronRightRounded";import u from"@material-ui/icons/Sort";import f from"@material-ui/icons/Check";import g from"@material-ui/icons/Close";import x from"../../IconButton/index.js";import b from"../../Button/index.js";import{jsxs as w,Fragment as C,jsx as I}from"react/jsx-runtime";var k=c((function(e){var r,t;return{drawer:function(r){var t=r.openedDrawerWidth;return o({height:"100%",position:"relative",width:t,borderTop:"1px solid",borderTopColor:e.palette.background.b7,boxShadow:"4px 0px 8px rgba(0, 0, 0, 0.15)"},"&.".concat("closed"),{width:"48px"})},drawerPaper:(r={position:"relative",width:"100%",backgroundColor:e.palette.background.b5},o(r,"&.".concat("closed"),{cursor:"pointer","&:hover":{backgroundColor:e.palette.background.b7,"& > $header":{backgroundColor:e.palette.background.b7}}}),o(r,"&.MuiDrawer-paperAnchorDockedLeft",{borderRight:"none"}),o(r,"&.MuiDrawer-paperAnchorDockedRight",{borderLeft:"none"}),r),header:(t={height:48,borderBottom:"1px solid",borderBottomColor:e.palette.background.b7,display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",top:0,left:0,right:0,letterSpacing:"1px",textTransform:"uppercase",fontSize:"14px",fontWeight:500,lineHeight:"20px",backgroundColor:e.palette.background.b5},o(t,"&.".concat("open"),{padding:e.spacing(1.5),justifyContent:"flex-start"}),o(t,"&.".concat("withShadow"),{zIndex:1,boxShadow:"-18px 12px 12px #272727"}),t),openToggleIconOpen:{transform:"rotate(180deg)"},openToggleContainer:function(e){var r,t=e.anchor;return o(r={alignItems:"center",bottom:0,display:"flex",flex:"0 0",height:48,justifyContent:"center",padding:6,position:"absolute",width:"100%"},"&.".concat("withShadow"),{zIndex:1,boxShadow:"-18px -12px 12px #272727"}),o(r,"&.".concat("open"),{justifyContent:"left"===t?"flex-end":"flex-start",paddingRight:6}),r},contentWrapper:{marginTop:48,height:"calc(100% - 96px)",overflowY:"auto"},content:{padding:"16px 12px",display:"flex",flexDirection:"column"},selectAllButton:{textTransform:"none",fontSize:"10px",lineHeight:"14px",letterSpacing:"0.4px",marginLeft:16,"& .MuiButton-startIcon":{marginRight:4}},headerIcon:{cursor:"pointer"},headerIconText:{cursor:"pointer"}}})),O=function(a){var l,c=a.anchor,O=a.children,v=a.drawerPaperClassName,S=a.header,T=a.headerIcon,A=a.headerTitleIcon,y=a.isOpen,N=a.openedDrawerWidth,B=a.setIsOpen,D=a.size,P=a.allOptionsButtonShown,R=a.isAllOptionsSelected,W=a.onAllOptionsClick,j=r(!1),z=e(j,2),H=z[0],L=z[1],M=t(),q=k({anchor:c,openedDrawerWidth:N||{small:235,medium:354,large:473}[D]});n((function(){var e=M.current,o=e.scrollHeight,r=e.clientHeight;L(o>r)}));var Y="left"===c?m:h;return w(p,{onClick:function(){y||B(!0)},className:i(q.drawer,!y&&"closed"),variant:"permanent",classes:{paper:i(q.drawerPaper,v,!y&&"closed")},anchor:c,children:[w("div",{className:i(q.header,y&&"open",H&&"withShadow"),onClick:function(){y&&B(!1)},children:[y&&w(C,{children:[A||I(u,{className:q.headerIcon}),I("div",{className:q.headerIconText,children:S}),P&&I(b,{className:q.selectAllButton,onClick:function(e){e.stopPropagation(),W(e)},startIcon:I(R?g:f,{}),children:R?"Clear All":"Select All"})]}),!y&&T]}),I("div",{className:q.contentWrapper,ref:M,children:I("div",{className:q.content,children:y&&O})}),I(d,{className:i(q.openToggleContainer,(l={},o(l,"open",y),o(l,"withShadow",H),l)),children:I(s,{title:y?"collapse":"expand",placement:"bottom",children:I("div",{children:I(x,{"aria-label":"toggle sidebar",onClick:function(){B(!y)},children:I(Y,{className:i(y&&q.openToggleIconOpen)})})})})})]})};O.propTypes={anchor:a.oneOf(["left","right"]),children:a.node.isRequired,drawerPaperClassName:a.string,header:a.node,headerIcon:a.node,headerTitleIcon:a.node,isOpen:a.bool,openedDrawerWidth:a.oneOfType([a.string,a.number]),setIsOpen:a.func,size:a.oneOf(["small","medium","large"]),allOptionsButtonShown:a.bool,isAllOptionsSelected:a.bool,onAllOptionsClick:a.func},O.defaultProps={anchor:"left",drawerPaperClassName:"",header:null,headerIcon:null,headerTitleIcon:null,isOpen:!1,openedDrawerWidth:0,setIsOpen:l,size:"medium",allOptionsButtonShown:!1,isAllOptionsSelected:!1,onAllOptionsClick:l};export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"
|
|
1
|
+
import e from"prop-types";import{makeStyles as t,Typography as r}from"@material-ui/core";import{isNativeDetected as i}from"../../../utils/mobileDetect.js";import s from"../../Attachment/index.js";import{formatMentionText as a}from"../../UserMention/utils/index.js";import o from"../../CollapsibleContent.js";import{jsxs as m,jsx as n}from"react/jsx-runtime";var p=t({wrapper:{whiteSpace:"pre-wrap"}}),d=function(e){var t=e.feedItem,d=t.context.post,u=d.body,c=d.attachment,l=void 0===c?{}:c,f=t.mentioned_users,h=p();return m("div",{className:h.wrapper,children:[u&&n(o,{children:n(r,{"data-testid":"".concat("PostFeedItem","_message"),variant:"body1",gutterBottom:!0,children:a(u,f,i)})}),n(s,{attachmentUrl:l.signed_url||l.url,fileName:l.file_name,attachmentSize:l.size,size:"medium"})]})};d.propTypes={feedItem:e.shape({context:e.shape({post:e.shape({body:e.string.isRequired,attachment:e.shape({url:e.string,size:e.number})}).isRequired}).isRequired,mentioned_users:e.arrayOf(e.shape({}))}).isRequired};export{d as default};
|