@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 n,useEffect as t}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}from"@material-ui/core";import s from"@material-ui/icons/ChevronLeftRounded";import h from"@material-ui/icons/ChevronRightRounded";import m from"@material-ui/icons/Sort";import u from"@material-ui/icons/Check";import f from"@material-ui/icons/Close";import g from"../../IconButton/index.js";import x from"../../Button/index.js";import{jsxs as b,Fragment as w,jsx as C}from"react/jsx-runtime";var I=c((function(e){var r,n;return{drawer:function(r){var n=r.openedDrawerWidth;return o({height:"100%",position:"relative",width:n,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:(n={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(n,"&.".concat("open"),{padding:e.spacing(1.5),justifyContent:"flex-start"}),o(n,"&.".concat("withShadow"),{zIndex:1,boxShadow:"-18px 12px 12px #272727"}),n),openToggleIconOpen:{transform:"rotate(180deg)"},openToggleContainer:function(e){var r,n=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"===n?"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"}}})),k=function(a){var l,c=a.anchor,k=a.children,O=a.drawerPaperClassName,S=a.header,v=a.headerIcon,T=a.headerTitleIcon,A=a.isOpen,y=a.openedDrawerWidth,N=a.setIsOpen,B=a.size,D=a.allOptionsButtonShown,P=a.isAllOptionsSelected,R=a.onAllOptionsClick,W=r(!1),j=e(W,2),z=j[0],H=j[1],L=n(),M=I({anchor:c,openedDrawerWidth:y||{small:235,medium:354,large:473}[B]});t((function(){var e=L.current,o=e.scrollHeight,r=e.clientHeight;H(o>r)}));var q="left"===c?h:s;return b(p,{onClick:function(){A||N(!0)},className:i(M.drawer,!A&&"closed"),variant:"permanent",classes:{paper:i(M.drawerPaper,O,!A&&"closed")},anchor:c,children:[b("div",{className:i(M.header,A&&"open",z&&"withShadow"),onClick:function(){A&&N(!1)},children:[A&&b(w,{children:[T||C(m,{className:M.headerIcon}),C("div",{className:M.headerIconText,children:S}),D&&C(x,{className:M.selectAllButton,onClick:function(e){e.stopPropagation(),R(e)},startIcon:C(P?f:u,{}),children:P?"Clear All":"Select All"})]}),!A&&v]}),C("div",{className:M.contentWrapper,ref:L,children:C("div",{className:M.content,children:A&&k})}),C(d,{className:i(M.openToggleContainer,(l={},o(l,"open",A),o(l,"withShadow",z),l)),children:C(g,{"aria-label":"toggle sidebar",onClick:function(){N(!A)},children:C(q,{className:i(A&&M.openToggleIconOpen)})})})]})};k.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},k.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{k as default};
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"@babel/runtime/helpers/defineProperty";import t from"prop-types";import{makeStyles as r,Typography as i}from"@material-ui/core";import{isNativeDetected as o}from"../../../utils/mobileDetect.js";import n from"../../Attachment/index.js";import{formatMentionText as s}from"../../UserMention/utils/index.js";import a from"../../CollapsibleContent.js";import{jsxs as p,jsx as m}from"react/jsx-runtime";function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function u(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?c(Object(i),!0).forEach((function(r){e(t,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):c(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}var f=r({wrapper:{whiteSpace:"pre-wrap"}}),l=function(e){var t=e.feedItem,r=t.context.post,c=r.body,l=r.attachment,d=void 0===l?{}:l,b=t.mentioned_users,h=f(),y={attachmentSize:d.size,size:"medium"};return d.file_name?y.fileName=d.file_name:y.attachmentUrl=d.url,p("div",{className:h.wrapper,children:[c&&m(a,{children:m(i,{"data-testid":"".concat("PostFeedItem","_message"),variant:"body1",gutterBottom:!0,children:s(c,b,o)})}),(d.file_name||d.url)&&m(n,u({},y))]})};l.propTypes={feedItem:t.shape({context:t.shape({post:t.shape({body:t.string.isRequired,attachment:t.shape({url:t.string,size:t.number})}).isRequired}).isRequired,mentioned_users:t.arrayOf(t.shape({}))}).isRequired};export{l as default};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.35.0-14",
3
+ "version": "0.35.0-15",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"