New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@twilio-paste/modal

Package Overview
Dependencies
Maintainers
5
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@twilio-paste/modal - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [0.1.1](https://github.com/twilio-labs/paste/compare/@twilio-paste/modal@0.1.0...@twilio-paste/modal@0.1.1) (2020-04-08)
### Bug Fixes
* **modal:** package dependencies updated to be correct ([22e114f](https://github.com/twilio-labs/paste/commit/22e114f0657325bc7bd34ec046f73712017bfd0f))
# 0.1.0 (2020-04-07)

@@ -8,0 +19,0 @@

34

dist/index.es.js

@@ -1,2 +0,2 @@

import{createContext as e,useContext as i,createElement as t,Children as o}from"react";import{node as r,bool as n,func as a,oneOf as l,object as s,string as d}from"prop-types";import c from"@emotion/styled";import p from"@styled-system/css";import{pasteBaseStyles as f}from"@twilio-paste/theme";import{ModalDialogPrimitiveOverlay as h,ModalDialogPrimitiveContent as u}from"@twilio-paste/modal-dialog-primitive";import{Box as m,safelySpreadBoxProps as g}from"@twilio-paste/box";import{Button as v}from"@twilio-paste/button";import{Flex as y}from"@twilio-paste/flex";import{UID as b}from"react-uid";import{system as w,compose as x,size as O,space as S,display as _,verticalAlign as z,overflow as N,position as C,typography as B}from"styled-system";import{ResponsiveProp as W,isFontFamilyTokenProp as R,isFontSizeTokenProp as E,isFontWeightTokenProp as H,isLineHeightTokenProp as j,isSpaceTokenProp as D,isTextColorTokenProp as P,SPACE_PROPS as T,TYPOGRAPHY_PROPS as k,OVERFLOW_PROPS as q}from"@twilio-paste/style-props";
import{createContext as e,useContext as o,createElement as r,Children as i}from"react";import{node as t,bool as n,func as l,oneOf as a,object as s,string as d}from"prop-types";import p from"@emotion/styled";import c from"@styled-system/css";import{pasteBaseStyles as u}from"@twilio-paste/theme";import{ModalDialogPrimitiveOverlay as m,ModalDialogPrimitiveContent as f}from"@twilio-paste/modal-dialog-primitive";import{Box as h,safelySpreadBoxProps as v}from"@twilio-paste/box";import{Button as y}from"@twilio-paste/button";import{Flex as b}from"@twilio-paste/flex";import{UID as g}from"react-uid";import{system as w,compose as x,size as C}from"styled-system";import{Heading as O}from"@twilio-paste/heading";
/*! *****************************************************************************

@@ -15,32 +15,2 @@ Copyright (c) Microsoft Corporation. All rights reserved.

and limitations under the License.
***************************************************************************** */var L=function(){return(L=Object.assign||function(e){for(var i,t=1,o=arguments.length;t<o;t++)for(var r in i=arguments[t])Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);return e}).apply(this,arguments)};function M(e,i){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&i.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)i.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}var I=e(null),F=c(h)(p({position:"fixed",top:0,right:0,bottom:0,left:0,display:"flex",justifyContent:"center",alignItems:"center",width:"100%",backgroundColor:"colorBackgroundOverlay"}),f),V=c(u)((function(e){var i=e.size;return p({width:"100%",maxWidth:"wide"===i?"size80":"size60",maxHeight:"90%",backgroundColor:"colorBackgroundBody",borderRadius:"borderRadius20",boxShadow:"shadowCard",display:"flex",flexDirection:"column"})})),A=function(e){var i=e.children,o=e.isOpen,r=e.onDismiss,n=e.allowPinchZoom,a=void 0===n||n,l=e.initialFocusRef,s=e.ariaLabelledby,d=e.size,c=M(e,["children","isOpen","onDismiss","allowPinchZoom","initialFocusRef","ariaLabelledby","size"]);return t(F,{isOpen:o,onDismiss:r,allowPinchZoom:a,initialFocusRef:l},t(I.Provider,{value:{onDismiss:r}},t(V,L({"aria-labelledby":s},c,{className:null,style:null,size:d}),i)))};A.displayName="Modal","development"===process.env.NODE_ENV&&(A.propTypes={children:r.isRequired,isOpen:n.isRequired,onDismiss:a.isRequired,allowPinchZoom:n,size:l(["default","wide"]).isRequired,initialFocusRef:s,ariaLabelledby:d.isRequired});var Z=w({iconColor:{property:"color",scale:"textColors"}}),Y=c.span({display:"inline-flex"},x(Z,O));Y.defaultProps={size:"sizeIcon30",iconColor:"currentColor"},Y.displayName="IconWrapper";var G=function(e){var i=e.as,o=e.size,r=e.iconColor,n=e.title,a=e.decorative;if(!a&&null==n)throw new Error("[CloseIcon]: Missing a title for non-decorative icon.");return t(Y,{as:i,size:o,iconColor:r},t(b,null,(function(e){return t("svg",{role:"img","aria-hidden":a,"aria-labelledby":e,width:"100%",height:"100%",viewBox:"0 0 24 24"},n?t("title",{id:e},n):null,t("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.01 5.99c.17.169.189.432.057.622l-.051.062-5.327 5.325 5.327 5.327c.19.19.185.494-.006.684a.488.488 0 01-.622.057l-.062-.051L12 12.689l-5.326 5.327a.481.481 0 01-.684-.006.488.488 0 01-.057-.622l.051-.062L11.311 12 5.984 6.674a.481.481 0 01.006-.684.488.488 0 01.622-.057l.062.051L12 11.31l5.326-5.326a.481.481 0 01.684.006z"}))})))};G.displayName="CloseIcon";var X=function(e){var o=e.children,r=M(e,["children"]),n=function(){var e=i(I);if(!e)throw new Error("useModalContext must be used with ModalContextProvider");return e}().onDismiss;return t(m,L({},g(r),{as:"header",borderBottomStyle:"solid",borderBottomWidth:"borderWidth10",borderBottomColor:"colorBorderLight",padding:"space50",flexShrink:0}),t(y,{hAlignContent:"between"},t(y,{vAlignContent:"center",grow:1,marginRight:"space70"},o),t(v,{variant:"reset",size:"reset",onClick:function(){return n()}},t(G,{decorative:!1,iconColor:"colorTextWeak",size:"sizeIcon60",title:"Close modal"}))))};X.displayName="ModalHeader","development"===process.env.NODE_ENV&&(X.propTypes={children:r.isRequired});var J={_hover:"&:hover",_active:"&:active, &[data-active=true]",_focus:"&:focus",_visited:"&:visited",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_disabled:"&:disabled, &:disabled:focus, &:disabled:hover, &[aria-disabled=true], &[aria-disabled=true]:focus, &[aria-disabled=true]:hover",_checked:"&:checked, &[aria-checked=true]",_mixed:"&:indeterminate, &[aria-checked=mixed]",_selected:"&[aria-selected=true]",_invalid:"&:invalid, &[aria-invalid=true]",_pressed:"&[aria-pressed=true]",_readOnly:"&[aria-readonly=true], &[readonly]",_first:"&:first-of-type",_last:"&:last-of-type",_expanded:"&[aria-expanded=true]",_grabbed:"&[aria-grabbed=true]",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_before:"&:before",_after:"&:after",_focusWithin:"&:focus-within"},K={as:d,display:W(d),cursor:W(d),content:W(d),fontFamily:R,fontSize:E,fontStyle:W(d),fontWeight:H,lineHeight:j,letterSpacing:W(d),margin:D,marginTop:D,marginRight:D,marginBottom:D,marginLeft:D,padding:D,paddingTop:D,paddingRight:D,paddingBottom:D,paddingLeft:D,overflow:W(d),overflowX:W(d),overflowY:W(d),textAlign:W(d),color:P,textDecoration:W(d),textOverflow:W(d),verticalAlign:W(d),whiteSpace:W(d)},Q=
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function(){for(var e=0,i=0,t=arguments.length;i<t;i++)e+=arguments[i].length;var o=Array(e),r=0;for(i=0;i<t;i++)for(var n=arguments[i],a=0,l=n.length;a<l;a++,r++)o[r]=n[a];return o}(T,k,q,["display","color","verticalAlign","className","style"]),U=w({color:{property:"color",scale:"textColors"},cursor:!0}),$=w({textDecoration:!0}),ee=c.span({margin:0,padding:0},x(S,_,z,N,C,$,B,U),(function(e){var i=Object.keys(e).filter((function(e){return e.startsWith("_")}));if(0===i.length)return{};var t={};return i.forEach((function(i){t[J[i]]=e[i]})),p(t)}));ee.displayName="Text",ee.defaultProps={fontSize:"fontSize30",lineHeight:"lineHeight30",color:"colorText"},"development"===process.env.NODE_ENV&&(ee.propTypes=K);
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var ie=function(){return(ie=Object.assign||function(e){for(var i,t=1,o=arguments.length;t<o;t++)for(var r in i=arguments[t])Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);return e}).apply(this,arguments)},te=function(e){var i,o=e.as,r=e.children,n=e.id,a=e.marginBottom,l=e.variant,s=function(e,i){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&i.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)i.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}(e,["as","children","id","marginBottom","variant"]);return t(ee,ie({},(i=s,Object.keys(i).reduce((function(e,t){return Q.includes(t)||(e[t]=i[t]),e}),{})),function(e,i){switch(e){case"heading10":return{marginBottom:i||"space70",fontSize:"fontSize90",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight90"};case"heading30":return{marginBottom:i||"space50",fontSize:"fontSize60",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight60"};case"heading40":return{marginBottom:i||"space40",fontSize:"fontSize40",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight40"};case"heading50":return{marginBottom:i||"space30",fontSize:"fontSize30",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight30"};case"heading60":return{marginBottom:i||"space30",fontSize:"fontSize20",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight20"};case"heading20":default:return{marginBottom:i||"space60",fontSize:"fontSize70",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight70"}}}(l,a),{as:o,display:"block",id:n,color:"colorText"}),r)};te.displayName="Heading",te.defaultProps={variant:"heading20"},"development"===process.env.NODE_ENV&&(te.propTypes={as:l(["h1","h2","h3","h4","h5","h6","div","label","span"]).isRequired,marginBottom:l(["space0"]),variant:l(["heading10","heading20","heading30","heading40","heading50","heading60"])});var oe=function(e){var i=e.children,o=e.as,r=void 0===o?"h2":o,n=M(e,["children","as"]);return t(te,L({},n,{as:r,marginBottom:"space0",variant:"heading30"}),i)};oe.displayName="ModalHeading","development"===process.env.NODE_ENV&&(oe.propTypes={children:r.isRequired,as:l(["h1","h2","h3","h4","h5","h6"])});var re=function(e){var i=e.children,o=M(e,["children"]);return t(m,L({},g(o),{as:"div",overflowY:"auto",padding:"space50",paddingBottom:"space60"}),i)};re.displayName="ModalBody","development"===process.env.NODE_ENV&&(re.propTypes={children:r.isRequired});var ne=function(e){var i=e.children,o=M(e,["children"]);return t(m,L({},g(o),{as:"footer",borderTopStyle:"solid",borderTopWidth:"borderWidth10",borderTopColor:"colorBorderLight",padding:"space50",display:"flex",flexShrink:0}),i)};ne.displayName="ModalFooter","development"===process.env.NODE_ENV&&(ne.propTypes={children:r.isRequired});var ae=function(e){var i=e.children,r=e.justify,n=o.count(i);return t(m,{display:"flex",justifyContent:"start"===r?"flex-start":"flex-end",flexShrink:"start"===r?null:0,flexWrap:"wrap",flexGrow:1,alignItems:"center"},o.map(i,(function(e,i){return t(m,{marginRight:n!==i+1?"space50":null},e)})))};ae.displayName="ModalFooterActions","development"===process.env.NODE_ENV&&(ae.propTypes={children:r.isRequired,justify:l(["start","end"])});export{A as Modal,re as ModalBody,ne as ModalFooter,ae as ModalFooterActions,X as ModalHeader,oe as ModalHeading};
***************************************************************************** */var N=function(){return(N=Object.assign||function(e){for(var o,r=1,i=arguments.length;r<i;r++)for(var t in o=arguments[r])Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t]);return e}).apply(this,arguments)};function R(e,o){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&o.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var t=0;for(i=Object.getOwnPropertySymbols(e);t<i.length;t++)o.indexOf(i[t])<0&&Object.prototype.propertyIsEnumerable.call(e,i[t])&&(r[i[t]]=e[i[t]])}return r}var z=e(null),E=p(m)(c({position:"fixed",top:0,right:0,bottom:0,left:0,display:"flex",justifyContent:"center",alignItems:"center",width:"100%",backgroundColor:"colorBackgroundOverlay"}),u),D=p(f)((function(e){var o=e.size;return c({width:"100%",maxWidth:"wide"===o?"size80":"size60",maxHeight:"90%",backgroundColor:"colorBackgroundBody",borderRadius:"borderRadius20",boxShadow:"shadowCard",display:"flex",flexDirection:"column"})})),B=function(e){var o=e.children,i=e.isOpen,t=e.onDismiss,n=e.allowPinchZoom,l=void 0===n||n,a=e.initialFocusRef,s=e.ariaLabelledby,d=e.size,p=R(e,["children","isOpen","onDismiss","allowPinchZoom","initialFocusRef","ariaLabelledby","size"]);return r(E,{isOpen:i,onDismiss:t,allowPinchZoom:l,initialFocusRef:a},r(z.Provider,{value:{onDismiss:t}},r(D,N({"aria-labelledby":s},p,{className:null,style:null,size:d}),o)))};B.displayName="Modal","development"===process.env.NODE_ENV&&(B.propTypes={children:t.isRequired,isOpen:n.isRequired,onDismiss:l.isRequired,allowPinchZoom:n,size:a(["default","wide"]).isRequired,initialFocusRef:s,ariaLabelledby:d.isRequired});var P=w({iconColor:{property:"color",scale:"textColors"}}),j=p.span({display:"inline-flex"},x(P,C));j.defaultProps={size:"sizeIcon30",iconColor:"currentColor"},j.displayName="IconWrapper";var q=function(e){var o=e.as,i=e.size,t=e.iconColor,n=e.title,l=e.decorative;if(!l&&null==n)throw new Error("[CloseIcon]: Missing a title for non-decorative icon.");return r(j,{as:o,size:i,iconColor:t},r(g,null,(function(e){return r("svg",{role:"img","aria-hidden":l,"aria-labelledby":e,width:"100%",height:"100%",viewBox:"0 0 24 24"},n?r("title",{id:e},n):null,r("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.01 5.99c.17.169.189.432.057.622l-.051.062-5.327 5.325 5.327 5.327c.19.19.185.494-.006.684a.488.488 0 01-.622.057l-.062-.051L12 12.689l-5.326 5.327a.481.481 0 01-.684-.006.488.488 0 01-.057-.622l.051-.062L11.311 12 5.984 6.674a.481.481 0 01.006-.684.488.488 0 01.622-.057l.062.051L12 11.31l5.326-5.326a.481.481 0 01.684.006z"}))})))};q.displayName="CloseIcon";var M=function(e){var i=e.children,t=R(e,["children"]),n=function(){var e=o(z);if(!e)throw new Error("useModalContext must be used with ModalContextProvider");return e}().onDismiss;return r(h,N({},v(t),{as:"header",borderBottomStyle:"solid",borderBottomWidth:"borderWidth10",borderBottomColor:"colorBorderLight",padding:"space50",flexShrink:0}),r(b,{hAlignContent:"between"},r(b,{vAlignContent:"center",grow:1,marginRight:"space70"},i),r(y,{variant:"reset",size:"reset",onClick:function(){return n()}},r(q,{decorative:!1,iconColor:"colorTextWeak",size:"sizeIcon60",title:"Close modal"}))))};M.displayName="ModalHeader","development"===process.env.NODE_ENV&&(M.propTypes={children:t.isRequired});var T=function(e){var o=e.children,i=e.as,t=void 0===i?"h2":i,n=R(e,["children","as"]);return r(O,N({},n,{as:t,marginBottom:"space0",variant:"heading30"}),o)};T.displayName="ModalHeading","development"===process.env.NODE_ENV&&(T.propTypes={children:t.isRequired,as:a(["h1","h2","h3","h4","h5","h6"])});var k=function(e){var o=e.children,i=R(e,["children"]);return r(h,N({},v(i),{as:"div",overflowY:"auto",padding:"space50",paddingBottom:"space60"}),o)};k.displayName="ModalBody","development"===process.env.NODE_ENV&&(k.propTypes={children:t.isRequired});var I=function(e){var o=e.children,i=R(e,["children"]);return r(h,N({},v(i),{as:"footer",borderTopStyle:"solid",borderTopWidth:"borderWidth10",borderTopColor:"colorBorderLight",padding:"space50",display:"flex",flexShrink:0}),o)};I.displayName="ModalFooter","development"===process.env.NODE_ENV&&(I.propTypes={children:t.isRequired});var L=function(e){var o=e.children,t=e.justify,n=i.count(o);return r(h,{display:"flex",justifyContent:"start"===t?"flex-start":"flex-end",flexShrink:"start"===t?null:0,flexWrap:"wrap",flexGrow:1,alignItems:"center"},i.map(o,(function(e,o){return r(h,{marginRight:n!==o+1?"space50":null},e)})))};L.displayName="ModalFooterActions","development"===process.env.NODE_ENV&&(L.propTypes={children:t.isRequired,justify:a(["start","end"])});export{B as Modal,k as ModalBody,I as ModalFooter,L as ModalFooterActions,M as ModalHeader,T as ModalHeading};

@@ -1,31 +0,1 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var o=require("react"),t=require("prop-types"),r=e(require("@emotion/styled")),i=e(require("@styled-system/css")),n=require("@twilio-paste/theme"),a=require("@twilio-paste/modal-dialog-primitive"),s=require("@twilio-paste/box"),l=require("@twilio-paste/button"),d=require("@twilio-paste/flex"),p=require("react-uid"),c=require("styled-system"),f=require("@twilio-paste/style-props"),u=function(){return(u=Object.assign||function(e){for(var o,t=1,r=arguments.length;t<r;t++)for(var i in o=arguments[t])Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i]);return e}).apply(this,arguments)};function h(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)o.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t}var g=o.createContext(null),m=r(a.ModalDialogPrimitiveOverlay)(i({position:"fixed",top:0,right:0,bottom:0,left:0,display:"flex",justifyContent:"center",alignItems:"center",width:"100%",backgroundColor:"colorBackgroundOverlay"}),n.pasteBaseStyles),v=r(a.ModalDialogPrimitiveContent)((function(e){var o=e.size;return i({width:"100%",maxWidth:"wide"===o?"size80":"size60",maxHeight:"90%",backgroundColor:"colorBackgroundBody",borderRadius:"borderRadius20",boxShadow:"shadowCard",display:"flex",flexDirection:"column"})})),y=function(e){var t=e.children,r=e.isOpen,i=e.onDismiss,n=e.allowPinchZoom,a=void 0===n||n,s=e.initialFocusRef,l=e.ariaLabelledby,d=e.size,p=h(e,["children","isOpen","onDismiss","allowPinchZoom","initialFocusRef","ariaLabelledby","size"]);return o.createElement(m,{isOpen:r,onDismiss:i,allowPinchZoom:a,initialFocusRef:s},o.createElement(g.Provider,{value:{onDismiss:i}},o.createElement(v,u({"aria-labelledby":l},p,{className:null,style:null,size:d}),t)))};y.displayName="Modal","development"===process.env.NODE_ENV&&(y.propTypes={children:t.node.isRequired,isOpen:t.bool.isRequired,onDismiss:t.func.isRequired,allowPinchZoom:t.bool,size:t.oneOf(["default","wide"]).isRequired,initialFocusRef:t.object,ariaLabelledby:t.string.isRequired});var b=c.system({iconColor:{property:"color",scale:"textColors"}}),x=r.span({display:"inline-flex"},c.compose(b,c.size));x.defaultProps={size:"sizeIcon30",iconColor:"currentColor"},x.displayName="IconWrapper";var P=function(e){var t=e.as,r=e.size,i=e.iconColor,n=e.title,a=e.decorative;if(!a&&null==n)throw new Error("[CloseIcon]: Missing a title for non-decorative icon.");return o.createElement(x,{as:t,size:r,iconColor:i},o.createElement(p.UID,null,(function(e){return o.createElement("svg",{role:"img","aria-hidden":a,"aria-labelledby":e,width:"100%",height:"100%",viewBox:"0 0 24 24"},n?o.createElement("title",{id:e},n):null,o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.01 5.99c.17.169.189.432.057.622l-.051.062-5.327 5.325 5.327 5.327c.19.19.185.494-.006.684a.488.488 0 01-.622.057l-.062-.051L12 12.689l-5.326 5.327a.481.481 0 01-.684-.006.488.488 0 01-.057-.622l.051-.062L11.311 12 5.984 6.674a.481.481 0 01.006-.684.488.488 0 01.622-.057l.062.051L12 11.31l5.326-5.326a.481.481 0 01.684.006z"}))})))};P.displayName="CloseIcon";var O=function(e){var t=e.children,r=h(e,["children"]),i=function(){var e=o.useContext(g);if(!e)throw new Error("useModalContext must be used with ModalContextProvider");return e}().onDismiss;return o.createElement(s.Box,u({},s.safelySpreadBoxProps(r),{as:"header",borderBottomStyle:"solid",borderBottomWidth:"borderWidth10",borderBottomColor:"colorBorderLight",padding:"space50",flexShrink:0}),o.createElement(d.Flex,{hAlignContent:"between"},o.createElement(d.Flex,{vAlignContent:"center",grow:1,marginRight:"space70"},t),o.createElement(l.Button,{variant:"reset",size:"reset",onClick:function(){return i()}},o.createElement(P,{decorative:!1,iconColor:"colorTextWeak",size:"sizeIcon60",title:"Close modal"}))))};O.displayName="ModalHeader","development"===process.env.NODE_ENV&&(O.propTypes={children:t.node.isRequired});var S={_hover:"&:hover",_active:"&:active, &[data-active=true]",_focus:"&:focus",_visited:"&:visited",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_disabled:"&:disabled, &:disabled:focus, &:disabled:hover, &[aria-disabled=true], &[aria-disabled=true]:focus, &[aria-disabled=true]:hover",_checked:"&:checked, &[aria-checked=true]",_mixed:"&:indeterminate, &[aria-checked=mixed]",_selected:"&[aria-selected=true]",_invalid:"&:invalid, &[aria-invalid=true]",_pressed:"&[aria-pressed=true]",_readOnly:"&[aria-readonly=true], &[readonly]",_first:"&:first-of-type",_last:"&:last-of-type",_expanded:"&[aria-expanded=true]",_grabbed:"&[aria-grabbed=true]",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_before:"&:before",_after:"&:after",_focusWithin:"&:focus-within"},w={as:t.string,display:f.ResponsiveProp(t.string),cursor:f.ResponsiveProp(t.string),content:f.ResponsiveProp(t.string),fontFamily:f.isFontFamilyTokenProp,fontSize:f.isFontSizeTokenProp,fontStyle:f.ResponsiveProp(t.string),fontWeight:f.isFontWeightTokenProp,lineHeight:f.isLineHeightTokenProp,letterSpacing:f.ResponsiveProp(t.string),margin:f.isSpaceTokenProp,marginTop:f.isSpaceTokenProp,marginRight:f.isSpaceTokenProp,marginBottom:f.isSpaceTokenProp,marginLeft:f.isSpaceTokenProp,padding:f.isSpaceTokenProp,paddingTop:f.isSpaceTokenProp,paddingRight:f.isSpaceTokenProp,paddingBottom:f.isSpaceTokenProp,paddingLeft:f.isSpaceTokenProp,overflow:f.ResponsiveProp(t.string),overflowX:f.ResponsiveProp(t.string),overflowY:f.ResponsiveProp(t.string),textAlign:f.ResponsiveProp(t.string),color:f.isTextColorTokenProp,textDecoration:f.ResponsiveProp(t.string),textOverflow:f.ResponsiveProp(t.string),verticalAlign:f.ResponsiveProp(t.string),whiteSpace:f.ResponsiveProp(t.string)},E=
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function(){for(var e=0,o=0,t=arguments.length;o<t;o++)e+=arguments[o].length;var r=Array(e),i=0;for(o=0;o<t;o++)for(var n=arguments[o],a=0,s=n.length;a<s;a++,i++)r[i]=n[a];return r}(f.SPACE_PROPS,f.TYPOGRAPHY_PROPS,f.OVERFLOW_PROPS,["display","color","verticalAlign","className","style"]),R=c.system({color:{property:"color",scale:"textColors"},cursor:!0}),_=c.system({textDecoration:!0}),B=r.span({margin:0,padding:0},c.compose(c.space,c.display,c.verticalAlign,c.overflow,c.position,_,c.typography,R),(function(e){var o=Object.keys(e).filter((function(e){return e.startsWith("_")}));if(0===o.length)return{};var t={};return o.forEach((function(o){t[S[o]]=e[o]})),i(t)}));B.displayName="Text",B.defaultProps={fontSize:"fontSize30",lineHeight:"lineHeight30",color:"colorText"},"development"===process.env.NODE_ENV&&(B.propTypes=w);
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var T=function(){return(T=Object.assign||function(e){for(var o,t=1,r=arguments.length;t<r;t++)for(var i in o=arguments[t])Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i]);return e}).apply(this,arguments)},z=function(e){var t,r=e.as,i=e.children,n=e.id,a=e.marginBottom,s=e.variant,l=function(e,o){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&o.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)o.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t}(e,["as","children","id","marginBottom","variant"]);return o.createElement(B,T({},(t=l,Object.keys(t).reduce((function(e,o){return E.includes(o)||(e[o]=t[o]),e}),{})),function(e,o){switch(e){case"heading10":return{marginBottom:o||"space70",fontSize:"fontSize90",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight90"};case"heading30":return{marginBottom:o||"space50",fontSize:"fontSize60",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight60"};case"heading40":return{marginBottom:o||"space40",fontSize:"fontSize40",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight40"};case"heading50":return{marginBottom:o||"space30",fontSize:"fontSize30",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight30"};case"heading60":return{marginBottom:o||"space30",fontSize:"fontSize20",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight20"};case"heading20":default:return{marginBottom:o||"space60",fontSize:"fontSize70",fontWeight:"fontWeightSemibold",lineHeight:"lineHeight70"}}}(s,a),{as:r,display:"block",id:n,color:"colorText"}),i)};z.displayName="Heading",z.defaultProps={variant:"heading20"},"development"===process.env.NODE_ENV&&(z.propTypes={as:t.oneOf(["h1","h2","h3","h4","h5","h6","div","label","span"]).isRequired,marginBottom:t.oneOf(["space0"]),variant:t.oneOf(["heading10","heading20","heading30","heading40","heading50","heading60"])});var k=function(e){var t=e.children,r=e.as,i=void 0===r?"h2":r,n=h(e,["children","as"]);return o.createElement(z,u({},n,{as:i,marginBottom:"space0",variant:"heading30"}),t)};k.displayName="ModalHeading","development"===process.env.NODE_ENV&&(k.propTypes={children:t.node.isRequired,as:t.oneOf(["h1","h2","h3","h4","h5","h6"])});var C=function(e){var t=e.children,r=h(e,["children"]);return o.createElement(s.Box,u({},s.safelySpreadBoxProps(r),{as:"div",overflowY:"auto",padding:"space50",paddingBottom:"space60"}),t)};C.displayName="ModalBody","development"===process.env.NODE_ENV&&(C.propTypes={children:t.node.isRequired});var N=function(e){var t=e.children,r=h(e,["children"]);return o.createElement(s.Box,u({},s.safelySpreadBoxProps(r),{as:"footer",borderTopStyle:"solid",borderTopWidth:"borderWidth10",borderTopColor:"colorBorderLight",padding:"space50",display:"flex",flexShrink:0}),t)};N.displayName="ModalFooter","development"===process.env.NODE_ENV&&(N.propTypes={children:t.node.isRequired});var W=function(e){var t=e.children,r=e.justify,i=o.Children.count(t);return o.createElement(s.Box,{display:"flex",justifyContent:"start"===r?"flex-start":"flex-end",flexShrink:"start"===r?null:0,flexWrap:"wrap",flexGrow:1,alignItems:"center"},o.Children.map(t,(function(e,t){return o.createElement(s.Box,{marginRight:i!==t+1?"space50":null},e)})))};W.displayName="ModalFooterActions","development"===process.env.NODE_ENV&&(W.propTypes={children:t.node.isRequired,justify:t.oneOf(["start","end"])}),exports.Modal=y,exports.ModalBody=C,exports.ModalFooter=N,exports.ModalFooterActions=W,exports.ModalHeader=O,exports.ModalHeading=k;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react"),o=require("prop-types"),t=e(require("@emotion/styled")),i=e(require("@styled-system/css")),n=require("@twilio-paste/theme"),l=require("@twilio-paste/modal-dialog-primitive"),a=require("@twilio-paste/box"),s=require("@twilio-paste/button"),d=require("@twilio-paste/flex"),c=require("react-uid"),p=require("styled-system"),u=require("@twilio-paste/heading"),m=function(){return(m=Object.assign||function(e){for(var r,o=1,t=arguments.length;o<t;o++)for(var i in r=arguments[o])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e}).apply(this,arguments)};function f(e,r){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);i<t.length;i++)r.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(o[t[i]]=e[t[i]])}return o}var h=r.createContext(null),y=t(l.ModalDialogPrimitiveOverlay)(i({position:"fixed",top:0,right:0,bottom:0,left:0,display:"flex",justifyContent:"center",alignItems:"center",width:"100%",backgroundColor:"colorBackgroundOverlay"}),n.pasteBaseStyles),v=t(l.ModalDialogPrimitiveContent)((function(e){var r=e.size;return i({width:"100%",maxWidth:"wide"===r?"size80":"size60",maxHeight:"90%",backgroundColor:"colorBackgroundBody",borderRadius:"borderRadius20",boxShadow:"shadowCard",display:"flex",flexDirection:"column"})})),x=function(e){var o=e.children,t=e.isOpen,i=e.onDismiss,n=e.allowPinchZoom,l=void 0===n||n,a=e.initialFocusRef,s=e.ariaLabelledby,d=e.size,c=f(e,["children","isOpen","onDismiss","allowPinchZoom","initialFocusRef","ariaLabelledby","size"]);return r.createElement(y,{isOpen:t,onDismiss:i,allowPinchZoom:l,initialFocusRef:a},r.createElement(h.Provider,{value:{onDismiss:i}},r.createElement(v,m({"aria-labelledby":s},c,{className:null,style:null,size:d}),o)))};x.displayName="Modal","development"===process.env.NODE_ENV&&(x.propTypes={children:o.node.isRequired,isOpen:o.bool.isRequired,onDismiss:o.func.isRequired,allowPinchZoom:o.bool,size:o.oneOf(["default","wide"]).isRequired,initialFocusRef:o.object,ariaLabelledby:o.string.isRequired});var b=p.system({iconColor:{property:"color",scale:"textColors"}}),g=t.span({display:"inline-flex"},p.compose(b,p.size));g.defaultProps={size:"sizeIcon30",iconColor:"currentColor"},g.displayName="IconWrapper";var E=function(e){var o=e.as,t=e.size,i=e.iconColor,n=e.title,l=e.decorative;if(!l&&null==n)throw new Error("[CloseIcon]: Missing a title for non-decorative icon.");return r.createElement(g,{as:o,size:t,iconColor:i},r.createElement(c.UID,null,(function(e){return r.createElement("svg",{role:"img","aria-hidden":l,"aria-labelledby":e,width:"100%",height:"100%",viewBox:"0 0 24 24"},n?r.createElement("title",{id:e},n):null,r.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.01 5.99c.17.169.189.432.057.622l-.051.062-5.327 5.325 5.327 5.327c.19.19.185.494-.006.684a.488.488 0 01-.622.057l-.062-.051L12 12.689l-5.326 5.327a.481.481 0 01-.684-.006.488.488 0 01-.057-.622l.051-.062L11.311 12 5.984 6.674a.481.481 0 01.006-.684.488.488 0 01.622-.057l.062.051L12 11.31l5.326-5.326a.481.481 0 01.684.006z"}))})))};E.displayName="CloseIcon";var w=function(e){var o=e.children,t=f(e,["children"]),i=function(){var e=r.useContext(h);if(!e)throw new Error("useModalContext must be used with ModalContextProvider");return e}().onDismiss;return r.createElement(a.Box,m({},a.safelySpreadBoxProps(t),{as:"header",borderBottomStyle:"solid",borderBottomWidth:"borderWidth10",borderBottomColor:"colorBorderLight",padding:"space50",flexShrink:0}),r.createElement(d.Flex,{hAlignContent:"between"},r.createElement(d.Flex,{vAlignContent:"center",grow:1,marginRight:"space70"},o),r.createElement(s.Button,{variant:"reset",size:"reset",onClick:function(){return i()}},r.createElement(E,{decorative:!1,iconColor:"colorTextWeak",size:"sizeIcon60",title:"Close modal"}))))};w.displayName="ModalHeader","development"===process.env.NODE_ENV&&(w.propTypes={children:o.node.isRequired});var C=function(e){var o=e.children,t=e.as,i=void 0===t?"h2":t,n=f(e,["children","as"]);return r.createElement(u.Heading,m({},n,{as:i,marginBottom:"space0",variant:"heading30"}),o)};C.displayName="ModalHeading","development"===process.env.NODE_ENV&&(C.propTypes={children:o.node.isRequired,as:o.oneOf(["h1","h2","h3","h4","h5","h6"])});var O=function(e){var o=e.children,t=f(e,["children"]);return r.createElement(a.Box,m({},a.safelySpreadBoxProps(t),{as:"div",overflowY:"auto",padding:"space50",paddingBottom:"space60"}),o)};O.displayName="ModalBody","development"===process.env.NODE_ENV&&(O.propTypes={children:o.node.isRequired});var B=function(e){var o=e.children,t=f(e,["children"]);return r.createElement(a.Box,m({},a.safelySpreadBoxProps(t),{as:"footer",borderTopStyle:"solid",borderTopWidth:"borderWidth10",borderTopColor:"colorBorderLight",padding:"space50",display:"flex",flexShrink:0}),o)};B.displayName="ModalFooter","development"===process.env.NODE_ENV&&(B.propTypes={children:o.node.isRequired});var q=function(e){var o=e.children,t=e.justify,i=r.Children.count(o);return r.createElement(a.Box,{display:"flex",justifyContent:"start"===t?"flex-start":"flex-end",flexShrink:"start"===t?null:0,flexWrap:"wrap",flexGrow:1,alignItems:"center"},r.Children.map(o,(function(e,o){return r.createElement(a.Box,{marginRight:i!==o+1?"space50":null},e)})))};q.displayName="ModalFooterActions","development"===process.env.NODE_ENV&&(q.propTypes={children:o.node.isRequired,justify:o.oneOf(["start","end"])}),exports.Modal=x,exports.ModalBody=O,exports.ModalFooter=B,exports.ModalFooterActions=q,exports.ModalHeader=w,exports.ModalHeading=C;
{
"name": "@twilio-paste/modal",
"version": "0.1.0",
"version": "0.1.1",
"category": "overlay",

@@ -35,13 +35,15 @@ "status": "beta",

"@styled-system/theme-get": "^5.1.2",
"@twilio-paste/absolute": "^2.0.25",
"@twilio-paste/box": "^2.2.6",
"@twilio-paste/button": "^1.1.32",
"@twilio-paste/design-tokens": "^4.3.0",
"@twilio-paste/flex": "^0.3.12",
"@twilio-paste/icons": "^2.0.7",
"@twilio-paste/absolute": "^2.0.27",
"@twilio-paste/box": "^2.2.8",
"@twilio-paste/button": "^1.1.34",
"@twilio-paste/design-tokens": "^4.4.0",
"@twilio-paste/flex": "^0.3.14",
"@twilio-paste/heading": "^1.2.0",
"@twilio-paste/icons": "^2.0.9",
"@twilio-paste/modal-dialog-primitive": "^0.1.2",
"@twilio-paste/spinner": "^1.1.26",
"@twilio-paste/style-props": "^0.2.3",
"@twilio-paste/theme": "^3.1.0",
"@twilio-paste/types": "^3.0.0",
"@twilio-paste/spinner": "^1.1.28",
"@twilio-paste/style-props": "^1.0.1",
"@twilio-paste/text": "^2.0.1",
"@twilio-paste/theme": "^3.1.1",
"@twilio-paste/types": "^3.0.1",
"prop-types": "^15.7.2",

@@ -59,12 +61,15 @@ "react": "^16.8.6",

"@rollup/plugin-node-resolve": "^7.1.1",
"@styled-system/css": "^5.1.5",
"@styled-system/theme-get": "^5.1.2",
"@twilio-paste/absolute": "^2.0.27",
"@twilio-paste/box": "^2.2.8",
"@twilio-paste/button": "^1.1.34",
"@twilio-paste/absolute": "^2.0.28",
"@twilio-paste/box": "^2.2.9",
"@twilio-paste/button": "^1.1.35",
"@twilio-paste/design-tokens": "^4.4.0",
"@twilio-paste/flex": "^0.3.14",
"@twilio-paste/icons": "^2.0.9",
"@twilio-paste/flex": "^0.3.15",
"@twilio-paste/heading": "^1.2.1",
"@twilio-paste/icons": "^2.0.10",
"@twilio-paste/modal-dialog-primitive": "^0.1.2",
"@twilio-paste/spinner": "^1.1.28",
"@twilio-paste/spinner": "^1.1.29",
"@twilio-paste/style-props": "^0.2.3",
"@twilio-paste/text": "^2.0.2",
"@twilio-paste/theme": "^3.1.1",

@@ -84,3 +89,3 @@ "@twilio-paste/types": "^3.0.1",

},
"gitHead": "f6bfb3986a9e73270398b5b6b16c56ea2f9e9655"
"gitHead": "641810d20776eded1cda9934c84903f4daf57372"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc