@corva/ui 0.76.0-0 → 0.76.0-1

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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),t=require("react"),i=require("classnames"),a=require("lodash"),n=require("@material-ui/core"),o=require("../IconButton/index.js"),c=require("../../constants/notifications.js"),r=require("./Toast.styles.js"),l=require("../../icons/index.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d,_=u(i),I="NotificationPopup",m=((d={})[c.NOTIFICATION_VARIANTS.success]=l.CheckOneIcon,d[c.NOTIFICATION_VARIANTS.warning]=l.CautionIcon,d[c.NOTIFICATION_VARIANTS.error]=l.AttentionIcon,d[c.NOTIFICATION_VARIANTS.info]=l.InfoIcon,d[c.NOTIFICATION_VARIANTS.neutral]=l.PuzzleIcon,d);exports.PAGE_NAME=I,exports.Toast=function(i){var u,d=i.onDismissClick,f=i.toast,N=e.__rest(i,["onDismissClick","toast"]),p=f.alertLevel,T=f.autoHideDuration,g=void 0===T?3e3:T,A=f.content,C=f.hideIcon,j=f.icon,v=f.id,x=f.onClick,h=void 0===x?a.noop:x,O=f.onClose,b=void 0===O?a.noop:O,y=f.timestamp,q=f.title,S=f.tooltipProps,k=f.variant,F=void 0===k?"info":k;t.useEffect((function(){if(g!==1/0){var e=setTimeout((function(){return d(v)}),g);return function(){return clearTimeout(e)}}}),[]);var R=r.useStyles(),V=m[F];return s.jsx(n.Grow,e.__assign({appear:!0,in:!0},{children:s.jsx(n.SnackbarContent,e.__assign({classes:{root:_.default(R.main,!p&&R[F],p&&R.alertNotification,p&&R["alertLevels-".concat(p)]),action:R.actionContainer,message:R.messageContainer},"aria-describedby":"client-snackbar",message:s.jsx(n.Tooltip,e.__assign({},S,{title:A,classes:{tooltip:R.tooltip},placement:"bottom"},{children:s.jsxs("div",e.__assign({id:"client-snackbar",className:R.messageWrapper,onClick:h,"data-testid":"".concat(I,"_status_").concat(c.NOTIFICATION_VARIANTS[F])},{children:[!C&&s.jsx("div",e.__assign({className:R.iconWrapper},{children:j?t.cloneElement(j,{className:R.icon,nativeColor:"#fff"}):s.jsx(V,{fill:F===c.NOTIFICATION_VARIANTS.warning?"#000":"#fff",size:16,className:R.icon})})),s.jsxs("div",e.__assign({className:R.message},{children:[s.jsxs("div",e.__assign({className:R.messageTop},{children:[q&&s.jsx(n.Typography,e.__assign({"data-testid":"".concat(I,"_title"),variant:"subtitle2",className:_.default(R.title,(u={},u[R.alertTitle]=p,u))},{children:q})),y&&s.jsx(n.Typography,e.__assign({className:_.default(R.timestamp,!p&&R[F])},{children:y}))]})),s.jsx("div",e.__assign({className:_.default(R.messageContent,!p&&R[F])},{children:s.jsx(n.Typography,e.__assign({"data-testid":"".concat(I,"_content"),className:_.default(p?R.alertContent:R.content)},{children:A}))}))]}))]}))})),action:[s.jsx(o,e.__assign({"data-testid":"".concat(I,"_closeButton"),"aria-label":"Close",color:"inherit",onClick:function(){b(),d(v)},size:"small",tooltipProps:{title:"Close",classes:{tooltip:R.tooltip}},className:R.closeIconButton},{children:s.jsx(l.CloseSmallIcon,{size:24,fill:p?"#000":"#fff"})}),"close")]},N))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require('./../../ext-esm/tslib/tslib.es6.js'),s=require("react/jsx-runtime"),t=require("react"),i=require("classnames"),a=require("lodash"),n=require("@material-ui/core"),o=require("../IconButton/index.js"),l=require("../../constants/notifications.js"),r=require("./Toast.styles.js"),c=require("../../icons/index.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d,I=u(i),_=((d={})[l.NOTIFICATION_VARIANTS.success]=c.CheckOneIcon,d[l.NOTIFICATION_VARIANTS.warning]=c.CautionIcon,d[l.NOTIFICATION_VARIANTS.error]=c.AttentionIcon,d[l.NOTIFICATION_VARIANTS.info]=c.InfoIcon,d[l.NOTIFICATION_VARIANTS.neutral]=c.PuzzleIcon,d);exports.Toast=function(i){var u,d=i.onDismissClick,m=i.toast,f=e.__rest(i,["onDismissClick","toast"]),p=m.alertLevel,N=m.autoHideDuration,T=void 0===N?3e3:N,g=m.content,C=m.hideIcon,j=m.icon,A=m.id,v=m.onClick,x=void 0===v?a.noop:v,h=m.onClose,O=void 0===h?a.noop:h,b=m.timestamp,y=m.title,q=m.tooltipProps,S=m.variant,k=void 0===S?"info":S;t.useEffect((function(){if(T!==1/0){var e=setTimeout((function(){return d(A)}),T);return function(){return clearTimeout(e)}}}),[]);var F=r.useStyles(),R=_[k];return s.jsx(n.Grow,e.__assign({appear:!0,in:!0},{children:s.jsx(n.SnackbarContent,e.__assign({classes:{root:I.default(F.main,!p&&F[k],p&&F.alertNotification,p&&F["alertLevels-".concat(p)]),action:F.actionContainer,message:F.messageContainer},"aria-describedby":"client-snackbar","data-testid":"notificationPopup_".concat(l.NOTIFICATION_VARIANTS[k]),message:s.jsx(n.Tooltip,e.__assign({},q,{title:g,classes:{tooltip:F.tooltip},placement:"bottom"},{children:s.jsxs("div",e.__assign({id:"client-snackbar",className:F.messageWrapper,onClick:x},{children:[!C&&s.jsx("div",e.__assign({className:F.iconWrapper},{children:j?t.cloneElement(j,{className:F.icon,nativeColor:"#fff"}):s.jsx(R,{fill:k===l.NOTIFICATION_VARIANTS.warning?"#000":"#fff",size:16,className:F.icon})})),s.jsxs("div",e.__assign({className:F.message},{children:[s.jsxs("div",e.__assign({className:F.messageTop},{children:[y&&s.jsx(n.Typography,e.__assign({"data-testid":"title",variant:"subtitle2",className:I.default(F.title,(u={},u[F.alertTitle]=p,u))},{children:y})),b&&s.jsx(n.Typography,e.__assign({className:I.default(F.timestamp,!p&&F[k])},{children:b}))]})),s.jsx("div",e.__assign({className:I.default(F.messageContent,!p&&F[k])},{children:s.jsx(n.Typography,e.__assign({"data-testid":"content",className:I.default(p?F.alertContent:F.content)},{children:g}))}))]}))]}))})),action:[s.jsx(o,e.__assign({"data-testid":"closeButton","aria-label":"Close",color:"inherit",onClick:function(){O(),d(A)},size:"small",tooltipProps:{title:"Close",classes:{tooltip:F.tooltip}},className:F.closeIconButton},{children:s.jsx(c.CloseSmallIcon,{size:24,fill:p?"#000":"#fff"})}),"close")]},f))}))};
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { Notification } from './types';
3
- export declare const PAGE_NAME = "NotificationPopup";
4
3
  interface ToastProps {
5
4
  onDismissClick: (id: string) => void;
6
5
  toast: Notification;
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/Toast.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAYvC,eAAO,MAAM,SAAS,sBAAsB,CAAC;AAU7C,UAAU,UAAU;IAClB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,eAAO,MAAM,KAAK,wCAAyC,UAAU,KAAG,WA4HvE,CAAC"}
1
+ {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Notifications/Toast.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAoBvC,UAAU,UAAU;IAClB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,YAAY,CAAC;CACrB;AAED,eAAO,MAAM,KAAK,wCAAyC,UAAU,KAAG,WA4HvE,CAAC"}
@@ -1 +1 @@
1
- import{__rest as t,__assign as i}from'./../../ext-esm/tslib/tslib.es6.js';import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useEffect as a,cloneElement as s}from"react";import n from"classnames";import{noop as c}from"lodash";import{Grow as r,SnackbarContent as l,Tooltip as m,Typography as d}from"@material-ui/core";import f from"../IconButton/index.js";import{NOTIFICATION_VARIANTS as p}from"../../constants/notifications.js";import{useStyles as u}from"./Toast.styles.js";import{CheckOneIcon as v,CautionIcon as h,AttentionIcon as C,InfoIcon as N,PuzzleIcon as b,CloseSmallIcon as g}from"../../icons/index.js";var k,j="NotificationPopup",_=((k={})[p.success]=v,k[p.warning]=h,k[p.error]=C,k[p.info]=N,k[p.neutral]=b,k),T=function(v){var h,C=v.onDismissClick,N=v.toast,b=t(v,["onDismissClick","toast"]),k=N.alertLevel,T=N.autoHideDuration,x=void 0===T?3e3:T,z=N.content,B=N.hideIcon,D=N.icon,I=N.id,P=N.onClick,w=void 0===P?c:P,y=N.onClose,L=void 0===y?c:y,W=N.timestamp,H=N.title,q=N.tooltipProps,A=N.variant,E=void 0===A?"info":A;a((function(){if(x!==1/0){var t=setTimeout((function(){return C(I)}),x);return function(){return clearTimeout(t)}}}),[]);var F=u(),G=_[E];return e(r,i({appear:!0,in:!0},{children:e(l,i({classes:{root:n(F.main,!k&&F[E],k&&F.alertNotification,k&&F["alertLevels-".concat(k)]),action:F.actionContainer,message:F.messageContainer},"aria-describedby":"client-snackbar",message:e(m,i({},q,{title:z,classes:{tooltip:F.tooltip},placement:"bottom"},{children:o("div",i({id:"client-snackbar",className:F.messageWrapper,onClick:w,"data-testid":"".concat(j,"_status_").concat(p[E])},{children:[!B&&e("div",i({className:F.iconWrapper},{children:D?s(D,{className:F.icon,nativeColor:"#fff"}):e(G,{fill:E===p.warning?"#000":"#fff",size:16,className:F.icon})})),o("div",i({className:F.message},{children:[o("div",i({className:F.messageTop},{children:[H&&e(d,i({"data-testid":"".concat(j,"_title"),variant:"subtitle2",className:n(F.title,(h={},h[F.alertTitle]=k,h))},{children:H})),W&&e(d,i({className:n(F.timestamp,!k&&F[E])},{children:W}))]})),e("div",i({className:n(F.messageContent,!k&&F[E])},{children:e(d,i({"data-testid":"".concat(j,"_content"),className:n(k?F.alertContent:F.content)},{children:z}))}))]}))]}))})),action:[e(f,i({"data-testid":"".concat(j,"_closeButton"),"aria-label":"Close",color:"inherit",onClick:function(){L(),C(I)},size:"small",tooltipProps:{title:"Close",classes:{tooltip:F.tooltip}},className:F.closeIconButton},{children:e(g,{size:24,fill:k?"#000":"#fff"})}),"close")]},b))}))};export{j as PAGE_NAME,T as Toast};
1
+ import{__rest as t,__assign as i}from'./../../ext-esm/tslib/tslib.es6.js';import{jsx as e,jsxs as o}from"react/jsx-runtime";import{useEffect as s,cloneElement as a}from"react";import n from"classnames";import{noop as r}from"lodash";import{Grow as l,SnackbarContent as c,Tooltip as m,Typography as d}from"@material-ui/core";import f from"../IconButton/index.js";import{NOTIFICATION_VARIANTS as p}from"../../constants/notifications.js";import{useStyles as u}from"./Toast.styles.js";import{CheckOneIcon as v,CautionIcon as h,AttentionIcon as C,InfoIcon as N,PuzzleIcon as b,CloseSmallIcon as g}from"../../icons/index.js";var k,j=((k={})[p.success]=v,k[p.warning]=h,k[p.error]=C,k[p.info]=N,k[p.neutral]=b,k),T=function(v){var h,C=v.onDismissClick,N=v.toast,b=t(v,["onDismissClick","toast"]),k=N.alertLevel,T=N.autoHideDuration,x=void 0===T?3e3:T,z=N.content,B=N.hideIcon,D=N.icon,I=N.id,P=N.onClick,w=void 0===P?r:P,y=N.onClose,L=void 0===y?r:y,W=N.timestamp,_=N.title,H=N.tooltipProps,q=N.variant,A=void 0===q?"info":q;s((function(){if(x!==1/0){var t=setTimeout((function(){return C(I)}),x);return function(){return clearTimeout(t)}}}),[]);var E=u(),F=j[A];return e(l,i({appear:!0,in:!0},{children:e(c,i({classes:{root:n(E.main,!k&&E[A],k&&E.alertNotification,k&&E["alertLevels-".concat(k)]),action:E.actionContainer,message:E.messageContainer},"aria-describedby":"client-snackbar","data-testid":"notificationPopup_".concat(p[A]),message:e(m,i({},H,{title:z,classes:{tooltip:E.tooltip},placement:"bottom"},{children:o("div",i({id:"client-snackbar",className:E.messageWrapper,onClick:w},{children:[!B&&e("div",i({className:E.iconWrapper},{children:D?a(D,{className:E.icon,nativeColor:"#fff"}):e(F,{fill:A===p.warning?"#000":"#fff",size:16,className:E.icon})})),o("div",i({className:E.message},{children:[o("div",i({className:E.messageTop},{children:[_&&e(d,i({"data-testid":"title",variant:"subtitle2",className:n(E.title,(h={},h[E.alertTitle]=k,h))},{children:_})),W&&e(d,i({className:n(E.timestamp,!k&&E[A])},{children:W}))]})),e("div",i({className:n(E.messageContent,!k&&E[A])},{children:e(d,i({"data-testid":"content",className:n(k?E.alertContent:E.content)},{children:z}))}))]}))]}))})),action:[e(f,i({"data-testid":"closeButton","aria-label":"Close",color:"inherit",onClick:function(){L(),C(I)},size:"small",tooltipProps:{title:"Close",classes:{tooltip:E.tooltip}},className:E.closeIconButton},{children:e(g,{size:24,fill:k?"#000":"#fff"})}),"close")]},b))}))};export{T as Toast};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corva/ui",
3
- "version": "0.76.0-0",
3
+ "version": "0.76.0-1",
4
4
  "description": "Shared components/utils for Corva ui projects",
5
5
  "keywords": [
6
6
  "corva-ui"