@twilio-paste/checkbox
Advanced tools
Comparing version
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.1.8](https://github.com/twilio-labs/paste/compare/@twilio-paste/checkbox@1.1.7...@twilio-paste/checkbox@1.1.8) (2020-10-21) | ||
**Note:** Version bump only for package @twilio-paste/checkbox | ||
## [1.1.7](https://github.com/twilio-labs/paste/compare/@twilio-paste/checkbox@1.1.6...@twilio-paste/checkbox@1.1.7) (2020-10-19) | ||
@@ -8,0 +16,0 @@ |
@@ -1,1 +0,1 @@ | ||
import{createElement as e,forwardRef as r,Children as i,isValidElement as o,cloneElement as l,Fragment as t}from"react";import{node as n,bool as a,oneOfType as c,string as d}from"prop-types";import{UID as s,useUID as p}from"react-uid";import{styled as u}from"@twilio-paste/styling-library";import{Box as h,safelySpreadBoxProps as f}from"@twilio-paste/box";import{BaseRadioCheckboxLabel as b,BaseRadioCheckboxControl as m,BaseRadioCheckboxLabelText as v,BaseRadioCheckboxHelpText as y}from"@twilio-paste/base-radio-checkbox";import{InlineControlGroup as g}from"@twilio-paste/inline-control-group";import{HelpText as x}from"@twilio-paste/help-text";var O=function(){return(O=Object.assign||function(e){for(var r,i=1,o=arguments.length;i<o;i++)for(var l in r=arguments[i])Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l]);return e}).apply(this,arguments)};function w(e,r){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(o=Object.getOwnPropertySymbols(e);l<o.length;l++)r.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(e,o[l])&&(i[o[l]]=e[o[l]])}return i}var k=function(){return(k=Object.assign||function(e){for(var r,i=1,o=arguments.length;i<o;i++)for(var l in r=arguments[i])Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l]);return e}).apply(this,arguments)},T=function(r){var i=r.display,o=r.color,l=r.size,t=function(e,r){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(o=Object.getOwnPropertySymbols(e);l<o.length;l++)r.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(e,o[l])&&(i[o[l]]=e[o[l]])}return i}(r,["display","color","size"]);return e(h,k({},f(t),{lineHeight:"lineHeight0",display:i,color:o,size:l}))};T.defaultProps={as:"span",display:"block",color:"currentColor",size:"sizeIcon30"},T.displayName="IconWrapper";var C=function(r){var i=r.as,o=r.display,l=r.size,t=r.color,n=r.title,a=r.decorative;if(!a&&null==n)throw new Error("[CheckboxCheckIcon]: Missing a title for non-decorative icon.");return e(T,{as:i,display:o,size:l,color:t},e(s,null,(function(r){return e("svg",{role:"img","aria-hidden":a,width:"100%",height:"100%",viewBox:"0 0 20 20","aria-labelledby":r},n?e("title",{id:r},n):null,e("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.59 5.916a1.386 1.386 0 00-1.98 0l-5.04 5.138L6.39 8.83a1.38 1.38 0 00-1.98 0 1.448 1.448 0 000 2.018l3.171 3.233a1.382 1.382 0 001.98 0l6.03-6.148a1.448 1.448 0 000-2.018z"}))})))};C.displayName="CheckboxCheckIcon";var S=function(r){var i=r.as,o=r.display,l=r.size,t=r.color,n=r.title,a=r.decorative;if(!a&&null==n)throw new Error("[MinusIcon]: Missing a title for non-decorative icon.");return e(T,{as:i,display:o,size:l,color:t},e(s,null,(function(r){return e("svg",{role:"img","aria-hidden":a,width:"100%",height:"100%",viewBox:"0 0 20 20","aria-labelledby":r},n?e("title",{id:r},n):null,e("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.167 9.5c.46 0 .833.448.833 1 0 .513-.322.936-.736.993l-.097.007H5.833c-.46 0-.833-.448-.833-1 0-.513.322-.936.736-.993l.097-.007h8.334z"}))})))};S.displayName="MinusIcon";var z=u.input({border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",textTransform:"none",whiteSpace:"nowrap",width:"1px"}),E=function(r){var i=r.disabled,o=r.checked,l=r.indeterminate,t=i&&(o||l)?"colorTextInverseWeaker":"colorTextInverse";return l?e(S,{decorative:!0,color:t,size:"sizeIcon10"}):e(C,{hidden:!o,decorative:!0,color:t,size:"sizeIcon10"})},I=r((function(r,i){var o=r.id,l=r.checked,t=r.children,n=r.helpText,a=r.disabled,c=r.hasError,d=r.indeterminate,s=r.isSelectAllChild,u=r.isSelectAll,f=w(r,["id","checked","children","helpText","disabled","hasError","indeterminate","isSelectAllChild","isSelectAll"]),g=p(),x=null,k=null;return u&&(x="space20",l||d?k="colorBackgroundPrimaryLightest":a||(k="colorBackground")),s&&(x="space30"),e(h,{backgroundColor:k,borderRadius:u?"borderRadius10":null,display:"inline-flex",flexDirection:"column",padding:u?"space30":null,paddingBottom:u?"space20":null,paddingLeft:x,paddingRight:s?"space30":null,paddingTop:u?"space20":null},e(z,O({},f,{"aria-describedby":g,"aria-checked":d?"mixed":l,"aria-invalid":c,checked:l,disabled:a,id:o,ref:i,type:"checkbox"})),e(b,{disabled:a,htmlFor:o},e(m,{alignItems:"center",borderRadius:"borderRadius10",disabled:a,position:"relative"},e(E,{checked:l,disabled:a,indeterminate:d})),e(v,{fontWeight:u?null:"fontWeightNormal"},t)),n&&e(y,{helpTextId:g},n))}));I.displayName="Checkbox","development"===process.env.NODE_ENV&&(I.propTypes={children:n.isRequired,hasError:a,helpText:c([d,n]),id:d.isRequired,indeterminate:a,isSelectAll:a,isSelectAllChild:a,value:d.isRequired});var N=function(r){var t=r.children,n=r.disabled,a=r.errorText,c=r.isSelectAll,d=r.name,s=r.orientation,p=void 0===s?"vertical":s,u=w(r,["children","disabled","errorText","isSelectAll","name","orientation"]);return e(g,O({},u,{errorText:a,name:d,disabled:n,orientation:p}),i.map(t,(function(e,r){return o(e)?l(e,{disabled:n,hasError:!!a||void 0,isSelectAll:c&&0===r,isSelectAllChild:c&&"vertical"===p&&0!==r,name:d}):e})))};N.displayName="CheckboxGroup","development"===process.env.NODE_ENV&&(N.propTypes={isSelectAll:a,name:d});var R=function(r){var i=r.children,o=r.errorText,l=w(r,["children","errorText"]);return e(t,null,e(h,{backgroundColor:"colorBackground",borderRadius:"borderRadius20",padding:"space50"},e(I,O({},l,{hasError:null!=o}),i)),o&&e(h,{marginTop:"space30",marginLeft:"space50"},e(x,{variant:"error"},o)))};R.displayName="CheckboxDisclaimer","development"===process.env.NODE_ENV&&(R.propTypes={children:n.isRequired,errorText:c([d,n])});export{I as Checkbox,R as CheckboxDisclaimer,N as CheckboxGroup}; | ||
import{createElement as e,forwardRef as r,Children as i,isValidElement as o,cloneElement as l,Fragment as t}from"react";import{node as n,bool as a,oneOfType as c,string as d}from"prop-types";import{useUID as s}from"@twilio-paste/uid-library";import{styled as p}from"@twilio-paste/styling-library";import{Box as u,safelySpreadBoxProps as h}from"@twilio-paste/box";import{BaseRadioCheckboxLabel as b,BaseRadioCheckboxControl as f,BaseRadioCheckboxLabelText as m,BaseRadioCheckboxHelpText as v}from"@twilio-paste/base-radio-checkbox";import{InlineControlGroup as y}from"@twilio-paste/inline-control-group";import{HelpText as g}from"@twilio-paste/help-text";var x=function(){return(x=Object.assign||function(e){for(var r,i=1,o=arguments.length;i<o;i++)for(var l in r=arguments[i])Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l]);return e}).apply(this,arguments)};function O(e,r){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(o=Object.getOwnPropertySymbols(e);l<o.length;l++)r.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(e,o[l])&&(i[o[l]]=e[o[l]])}return i}var w=function(){return(w=Object.assign||function(e){for(var r,i=1,o=arguments.length;i<o;i++)for(var l in r=arguments[i])Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l]);return e}).apply(this,arguments)},k=function(r){var i=r.display,o=r.color,l=r.size,t=function(e,r){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(o=Object.getOwnPropertySymbols(e);l<o.length;l++)r.indexOf(o[l])<0&&Object.prototype.propertyIsEnumerable.call(e,o[l])&&(i[o[l]]=e[o[l]])}return i}(r,["display","color","size"]);return e(u,w({},h(t),{lineHeight:"lineHeight0",display:i,color:o,size:l}))};k.defaultProps={as:"span",display:"block",color:"currentColor",size:"sizeIcon30"},k.displayName="IconWrapper";var C=function(r){var i=r.as,o=r.display,l=r.size,t=r.color,n=r.title,a=r.decorative,c="CheckboxCheckIcon-"+s();if(!a&&null==n)throw new Error("[CheckboxCheckIcon]: Missing a title for non-decorative icon.");return e(k,{as:i,display:o,size:l,color:t},e("svg",{role:"img","aria-hidden":a,width:"100%",height:"100%",viewBox:"0 0 20 20","aria-labelledby":c},n?e("title",{id:c},n):null,e("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.59 5.916a1.386 1.386 0 00-1.98 0l-5.04 5.138L6.39 8.83a1.38 1.38 0 00-1.98 0 1.448 1.448 0 000 2.018l3.171 3.233a1.382 1.382 0 001.98 0l6.03-6.148a1.448 1.448 0 000-2.018z"})))};C.displayName="CheckboxCheckIcon";var T=function(r){var i=r.as,o=r.display,l=r.size,t=r.color,n=r.title,a=r.decorative,c="MinusIcon-"+s();if(!a&&null==n)throw new Error("[MinusIcon]: Missing a title for non-decorative icon.");return e(k,{as:i,display:o,size:l,color:t},e("svg",{role:"img","aria-hidden":a,width:"100%",height:"100%",viewBox:"0 0 20 20","aria-labelledby":c},n?e("title",{id:c},n):null,e("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.167 9.5c.46 0 .833.448.833 1 0 .513-.322.936-.736.993l-.097.007H5.833c-.46 0-.833-.448-.833-1 0-.513.322-.936.736-.993l.097-.007h8.334z"})))};T.displayName="MinusIcon";var I=p.input({border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",textTransform:"none",whiteSpace:"nowrap",width:"1px"}),S=function(r){var i=r.disabled,o=r.checked,l=r.indeterminate,t=i&&(o||l)?"colorTextInverseWeaker":"colorTextInverse";return l?e(T,{decorative:!0,color:t,size:"sizeIcon10"}):e(C,{hidden:!o,decorative:!0,color:t,size:"sizeIcon10"})},z=r((function(r,i){var o=r.id,l=r.checked,t=r.children,n=r.helpText,a=r.disabled,c=r.hasError,d=r.indeterminate,p=r.isSelectAllChild,h=r.isSelectAll,y=O(r,["id","checked","children","helpText","disabled","hasError","indeterminate","isSelectAllChild","isSelectAll"]),g=s(),w=null,k=null;return h&&(w="space20",l||d?k="colorBackgroundPrimaryLightest":a||(k="colorBackground")),p&&(w="space30"),e(u,{backgroundColor:k,borderRadius:h?"borderRadius10":null,display:"inline-flex",flexDirection:"column",padding:h?"space30":null,paddingBottom:h?"space20":null,paddingLeft:w,paddingRight:p?"space30":null,paddingTop:h?"space20":null},e(I,x({},y,{"aria-describedby":g,"aria-checked":d?"mixed":l,"aria-invalid":c,checked:l,disabled:a,id:o,ref:i,type:"checkbox"})),e(b,{disabled:a,htmlFor:o},e(f,{alignItems:"center",borderRadius:"borderRadius10",disabled:a,position:"relative"},e(S,{checked:l,disabled:a,indeterminate:d})),e(m,{fontWeight:h?null:"fontWeightNormal"},t)),n&&e(v,{helpTextId:g},n))}));z.displayName="Checkbox","development"===process.env.NODE_ENV&&(z.propTypes={children:n.isRequired,hasError:a,helpText:c([d,n]),id:d.isRequired,indeterminate:a,isSelectAll:a,isSelectAllChild:a,value:d.isRequired});var E=function(r){var t=r.children,n=r.disabled,a=r.errorText,c=r.isSelectAll,d=r.name,s=r.orientation,p=void 0===s?"vertical":s,u=O(r,["children","disabled","errorText","isSelectAll","name","orientation"]);return e(y,x({},u,{errorText:a,name:d,disabled:n,orientation:p}),i.map(t,(function(e,r){return o(e)?l(e,{disabled:n,hasError:!!a||void 0,isSelectAll:c&&0===r,isSelectAllChild:c&&"vertical"===p&&0!==r,name:d}):e})))};E.displayName="CheckboxGroup","development"===process.env.NODE_ENV&&(E.propTypes={isSelectAll:a,name:d});var N=function(r){var i=r.children,o=r.errorText,l=O(r,["children","errorText"]);return e(t,null,e(u,{backgroundColor:"colorBackground",borderRadius:"borderRadius20",padding:"space50"},e(z,x({},l,{hasError:null!=o}),i)),o&&e(u,{marginTop:"space30",marginLeft:"space50"},e(g,{variant:"error"},o)))};N.displayName="CheckboxDisclaimer","development"===process.env.NODE_ENV&&(N.propTypes={children:n.isRequired,errorText:c([d,n])});export{z as Checkbox,N as CheckboxDisclaimer,E as CheckboxGroup}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("prop-types"),t=require("react-uid"),l=require("@twilio-paste/styling-library"),i=require("@twilio-paste/box"),o=require("@twilio-paste/base-radio-checkbox"),n=require("@twilio-paste/inline-control-group"),a=require("@twilio-paste/help-text"),c=function(){return(c=Object.assign||function(e){for(var r,t=1,l=arguments.length;t<l;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e}).apply(this,arguments)};function d(e,r){var t={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&r.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(l=Object.getOwnPropertySymbols(e);i<l.length;i++)r.indexOf(l[i])<0&&Object.prototype.propertyIsEnumerable.call(e,l[i])&&(t[l[i]]=e[l[i]])}return t}var s=function(){return(s=Object.assign||function(e){for(var r,t=1,l=arguments.length;t<l;t++)for(var i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i]);return e}).apply(this,arguments)},p=function(r){var t=r.display,l=r.color,o=r.size,n=function(e,r){var t={};for(var l in e)Object.prototype.hasOwnProperty.call(e,l)&&r.indexOf(l)<0&&(t[l]=e[l]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(l=Object.getOwnPropertySymbols(e);i<l.length;i++)r.indexOf(l[i])<0&&Object.prototype.propertyIsEnumerable.call(e,l[i])&&(t[l[i]]=e[l[i]])}return t}(r,["display","color","size"]);return e.createElement(i.Box,s({},i.safelySpreadBoxProps(n),{lineHeight:"lineHeight0",display:t,color:l,size:o}))};p.defaultProps={as:"span",display:"block",color:"currentColor",size:"sizeIcon30"},p.displayName="IconWrapper";var u=function(r){var l=r.as,i=r.display,o=r.size,n=r.color,a=r.title,c=r.decorative;if(!c&&null==a)throw new Error("[CheckboxCheckIcon]: Missing a title for non-decorative icon.");return e.createElement(p,{as:l,display:i,size:o,color:n},e.createElement(t.UID,null,(function(r){return e.createElement("svg",{role:"img","aria-hidden":c,width:"100%",height:"100%",viewBox:"0 0 20 20","aria-labelledby":r},a?e.createElement("title",{id:r},a):null,e.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.59 5.916a1.386 1.386 0 00-1.98 0l-5.04 5.138L6.39 8.83a1.38 1.38 0 00-1.98 0 1.448 1.448 0 000 2.018l3.171 3.233a1.382 1.382 0 001.98 0l6.03-6.148a1.448 1.448 0 000-2.018z"}))})))};u.displayName="CheckboxCheckIcon";var h=function(r){var l=r.as,i=r.display,o=r.size,n=r.color,a=r.title,c=r.decorative;if(!c&&null==a)throw new Error("[MinusIcon]: Missing a title for non-decorative icon.");return e.createElement(p,{as:l,display:i,size:o,color:n},e.createElement(t.UID,null,(function(r){return e.createElement("svg",{role:"img","aria-hidden":c,width:"100%",height:"100%",viewBox:"0 0 20 20","aria-labelledby":r},a?e.createElement("title",{id:r},a):null,e.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.167 9.5c.46 0 .833.448.833 1 0 .513-.322.936-.736.993l-.097.007H5.833c-.46 0-.833-.448-.833-1 0-.513.322-.936.736-.993l.097-.007h8.334z"}))})))};h.displayName="MinusIcon";var b=l.styled.input({border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",textTransform:"none",whiteSpace:"nowrap",width:"1px"}),m=function(r){var t=r.disabled,l=r.checked,i=r.indeterminate,o=t&&(l||i)?"colorTextInverseWeaker":"colorTextInverse";return i?e.createElement(h,{decorative:!0,color:o,size:"sizeIcon10"}):e.createElement(u,{hidden:!l,decorative:!0,color:o,size:"sizeIcon10"})},f=e.forwardRef((function(r,l){var n=r.id,a=r.checked,s=r.children,p=r.helpText,u=r.disabled,h=r.hasError,f=r.indeterminate,y=r.isSelectAllChild,v=r.isSelectAll,x=d(r,["id","checked","children","helpText","disabled","hasError","indeterminate","isSelectAllChild","isSelectAll"]),g=t.useUID(),E=null,O=null;return v&&(E="space20",a||f?O="colorBackgroundPrimaryLightest":u||(O="colorBackground")),y&&(E="space30"),e.createElement(i.Box,{backgroundColor:O,borderRadius:v?"borderRadius10":null,display:"inline-flex",flexDirection:"column",padding:v?"space30":null,paddingBottom:v?"space20":null,paddingLeft:E,paddingRight:y?"space30":null,paddingTop:v?"space20":null},e.createElement(b,c({},x,{"aria-describedby":g,"aria-checked":f?"mixed":a,"aria-invalid":h,checked:a,disabled:u,id:n,ref:l,type:"checkbox"})),e.createElement(o.BaseRadioCheckboxLabel,{disabled:u,htmlFor:n},e.createElement(o.BaseRadioCheckboxControl,{alignItems:"center",borderRadius:"borderRadius10",disabled:u,position:"relative"},e.createElement(m,{checked:a,disabled:u,indeterminate:f})),e.createElement(o.BaseRadioCheckboxLabelText,{fontWeight:v?null:"fontWeightNormal"},s)),p&&e.createElement(o.BaseRadioCheckboxHelpText,{helpTextId:g},p))}));f.displayName="Checkbox","development"===process.env.NODE_ENV&&(f.propTypes={children:r.node.isRequired,hasError:r.bool,helpText:r.oneOfType([r.string,r.node]),id:r.string.isRequired,indeterminate:r.bool,isSelectAll:r.bool,isSelectAllChild:r.bool,value:r.string.isRequired});var y=function(r){var t=r.children,l=r.disabled,i=r.errorText,o=r.isSelectAll,a=r.name,s=r.orientation,p=void 0===s?"vertical":s,u=d(r,["children","disabled","errorText","isSelectAll","name","orientation"]);return e.createElement(n.InlineControlGroup,c({},u,{errorText:i,name:a,disabled:l,orientation:p}),e.Children.map(t,(function(r,t){return e.isValidElement(r)?e.cloneElement(r,{disabled:l,hasError:!!i||void 0,isSelectAll:o&&0===t,isSelectAllChild:o&&"vertical"===p&&0!==t,name:a}):r})))};y.displayName="CheckboxGroup","development"===process.env.NODE_ENV&&(y.propTypes={isSelectAll:r.bool,name:r.string});var v=function(r){var t=r.children,l=r.errorText,o=d(r,["children","errorText"]);return e.createElement(e.Fragment,null,e.createElement(i.Box,{backgroundColor:"colorBackground",borderRadius:"borderRadius20",padding:"space50"},e.createElement(f,c({},o,{hasError:null!=l}),t)),l&&e.createElement(i.Box,{marginTop:"space30",marginLeft:"space50"},e.createElement(a.HelpText,{variant:"error"},l)))};v.displayName="CheckboxDisclaimer","development"===process.env.NODE_ENV&&(v.propTypes={children:r.node.isRequired,errorText:r.oneOfType([r.string,r.node])}),exports.Checkbox=f,exports.CheckboxDisclaimer=v,exports.CheckboxGroup=y; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("prop-types"),t=require("@twilio-paste/uid-library"),i=require("@twilio-paste/styling-library"),l=require("@twilio-paste/box"),o=require("@twilio-paste/base-radio-checkbox"),n=require("@twilio-paste/inline-control-group"),a=require("@twilio-paste/help-text"),c=function(){return(c=Object.assign||function(e){for(var r,t=1,i=arguments.length;t<i;t++)for(var l in r=arguments[t])Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l]);return e}).apply(this,arguments)};function d(e,r){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&r.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)r.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(t[i[l]]=e[i[l]])}return t}var s=function(){return(s=Object.assign||function(e){for(var r,t=1,i=arguments.length;t<i;t++)for(var l in r=arguments[t])Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l]);return e}).apply(this,arguments)},p=function(r){var t=r.display,i=r.color,o=r.size,n=function(e,r){var t={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&r.indexOf(i)<0&&(t[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(i=Object.getOwnPropertySymbols(e);l<i.length;l++)r.indexOf(i[l])<0&&Object.prototype.propertyIsEnumerable.call(e,i[l])&&(t[i[l]]=e[i[l]])}return t}(r,["display","color","size"]);return e.createElement(l.Box,s({},l.safelySpreadBoxProps(n),{lineHeight:"lineHeight0",display:t,color:i,size:o}))};p.defaultProps={as:"span",display:"block",color:"currentColor",size:"sizeIcon30"},p.displayName="IconWrapper";var u=function(r){var i=r.as,l=r.display,o=r.size,n=r.color,a=r.title,c=r.decorative,d="CheckboxCheckIcon-"+t.useUID();if(!c&&null==a)throw new Error("[CheckboxCheckIcon]: Missing a title for non-decorative icon.");return e.createElement(p,{as:i,display:l,size:o,color:n},e.createElement("svg",{role:"img","aria-hidden":c,width:"100%",height:"100%",viewBox:"0 0 20 20","aria-labelledby":d},a?e.createElement("title",{id:d},a):null,e.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.59 5.916a1.386 1.386 0 00-1.98 0l-5.04 5.138L6.39 8.83a1.38 1.38 0 00-1.98 0 1.448 1.448 0 000 2.018l3.171 3.233a1.382 1.382 0 001.98 0l6.03-6.148a1.448 1.448 0 000-2.018z"})))};u.displayName="CheckboxCheckIcon";var h=function(r){var i=r.as,l=r.display,o=r.size,n=r.color,a=r.title,c=r.decorative,d="MinusIcon-"+t.useUID();if(!c&&null==a)throw new Error("[MinusIcon]: Missing a title for non-decorative icon.");return e.createElement(p,{as:i,display:l,size:o,color:n},e.createElement("svg",{role:"img","aria-hidden":c,width:"100%",height:"100%",viewBox:"0 0 20 20","aria-labelledby":d},a?e.createElement("title",{id:d},a):null,e.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.167 9.5c.46 0 .833.448.833 1 0 .513-.322.936-.736.993l-.097.007H5.833c-.46 0-.833-.448-.833-1 0-.513.322-.936.736-.993l.097-.007h8.334z"})))};h.displayName="MinusIcon";var b=i.styled.input({border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",textTransform:"none",whiteSpace:"nowrap",width:"1px"}),m=function(r){var t=r.disabled,i=r.checked,l=r.indeterminate,o=t&&(i||l)?"colorTextInverseWeaker":"colorTextInverse";return l?e.createElement(h,{decorative:!0,color:o,size:"sizeIcon10"}):e.createElement(u,{hidden:!i,decorative:!0,color:o,size:"sizeIcon10"})},f=e.forwardRef((function(r,i){var n=r.id,a=r.checked,s=r.children,p=r.helpText,u=r.disabled,h=r.hasError,f=r.indeterminate,y=r.isSelectAllChild,v=r.isSelectAll,x=d(r,["id","checked","children","helpText","disabled","hasError","indeterminate","isSelectAllChild","isSelectAll"]),g=t.useUID(),E=null,k=null;return v&&(E="space20",a||f?k="colorBackgroundPrimaryLightest":u||(k="colorBackground")),y&&(E="space30"),e.createElement(l.Box,{backgroundColor:k,borderRadius:v?"borderRadius10":null,display:"inline-flex",flexDirection:"column",padding:v?"space30":null,paddingBottom:v?"space20":null,paddingLeft:E,paddingRight:y?"space30":null,paddingTop:v?"space20":null},e.createElement(b,c({},x,{"aria-describedby":g,"aria-checked":f?"mixed":a,"aria-invalid":h,checked:a,disabled:u,id:n,ref:i,type:"checkbox"})),e.createElement(o.BaseRadioCheckboxLabel,{disabled:u,htmlFor:n},e.createElement(o.BaseRadioCheckboxControl,{alignItems:"center",borderRadius:"borderRadius10",disabled:u,position:"relative"},e.createElement(m,{checked:a,disabled:u,indeterminate:f})),e.createElement(o.BaseRadioCheckboxLabelText,{fontWeight:v?null:"fontWeightNormal"},s)),p&&e.createElement(o.BaseRadioCheckboxHelpText,{helpTextId:g},p))}));f.displayName="Checkbox","development"===process.env.NODE_ENV&&(f.propTypes={children:r.node.isRequired,hasError:r.bool,helpText:r.oneOfType([r.string,r.node]),id:r.string.isRequired,indeterminate:r.bool,isSelectAll:r.bool,isSelectAllChild:r.bool,value:r.string.isRequired});var y=function(r){var t=r.children,i=r.disabled,l=r.errorText,o=r.isSelectAll,a=r.name,s=r.orientation,p=void 0===s?"vertical":s,u=d(r,["children","disabled","errorText","isSelectAll","name","orientation"]);return e.createElement(n.InlineControlGroup,c({},u,{errorText:l,name:a,disabled:i,orientation:p}),e.Children.map(t,(function(r,t){return e.isValidElement(r)?e.cloneElement(r,{disabled:i,hasError:!!l||void 0,isSelectAll:o&&0===t,isSelectAllChild:o&&"vertical"===p&&0!==t,name:a}):r})))};y.displayName="CheckboxGroup","development"===process.env.NODE_ENV&&(y.propTypes={isSelectAll:r.bool,name:r.string});var v=function(r){var t=r.children,i=r.errorText,o=d(r,["children","errorText"]);return e.createElement(e.Fragment,null,e.createElement(l.Box,{backgroundColor:"colorBackground",borderRadius:"borderRadius20",padding:"space50"},e.createElement(f,c({},o,{hasError:null!=i}),t)),i&&e.createElement(l.Box,{marginTop:"space30",marginLeft:"space50"},e.createElement(a.HelpText,{variant:"error"},i)))};v.displayName="CheckboxDisclaimer","development"===process.env.NODE_ENV&&(v.propTypes={children:r.node.isRequired,errorText:r.oneOfType([r.string,r.node])}),exports.Checkbox=f,exports.CheckboxDisclaimer=v,exports.CheckboxGroup=y; |
{ | ||
"name": "@twilio-paste/checkbox", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"category": "user input", | ||
@@ -31,9 +31,9 @@ "status": "production", | ||
"peerDependencies": { | ||
"@twilio-paste/base-radio-checkbox": "^1.1.6", | ||
"@twilio-paste/base-radio-checkbox": "^1.1.7", | ||
"@twilio-paste/box": "^2.11.5", | ||
"@twilio-paste/design-tokens": "^6.3.4", | ||
"@twilio-paste/flex": "^0.3.65", | ||
"@twilio-paste/help-text": "^1.1.6", | ||
"@twilio-paste/icons": "^3.6.2", | ||
"@twilio-paste/inline-control-group": "^1.1.6", | ||
"@twilio-paste/help-text": "^1.1.7", | ||
"@twilio-paste/icons": "^3.7.0", | ||
"@twilio-paste/inline-control-group": "^1.1.7", | ||
"@twilio-paste/label": "^1.1.5", | ||
@@ -47,18 +47,18 @@ "@twilio-paste/screen-reader-only": "^1.1.13", | ||
"@twilio-paste/types": "^3.0.27", | ||
"@twilio-paste/uid-library": "^0.0.1", | ||
"prop-types": "^15.7.2", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
"react-uid": "^2.2.0" | ||
"react-dom": "^16.8.6" | ||
}, | ||
"devDependencies": { | ||
"@twilio-paste/base-radio-checkbox": "^1.1.7", | ||
"@twilio-paste/base-radio-checkbox": "^1.1.8", | ||
"@twilio-paste/box": "^2.11.5", | ||
"@twilio-paste/design-tokens": "^6.3.4", | ||
"@twilio-paste/flex": "^0.3.65", | ||
"@twilio-paste/help-text": "^1.1.7", | ||
"@twilio-paste/icons": "^3.7.0", | ||
"@twilio-paste/inline-control-group": "^1.1.7", | ||
"@twilio-paste/label": "^1.1.5", | ||
"@twilio-paste/help-text": "^1.1.8", | ||
"@twilio-paste/icons": "^3.7.1", | ||
"@twilio-paste/inline-control-group": "^1.1.8", | ||
"@twilio-paste/label": "^1.1.6", | ||
"@twilio-paste/screen-reader-only": "^1.1.13", | ||
"@twilio-paste/sibling-box": "^1.1.5", | ||
"@twilio-paste/sibling-box": "^1.1.6", | ||
"@twilio-paste/style-props": "^1.8.5", | ||
@@ -68,5 +68,6 @@ "@twilio-paste/styling-library": "^0.1.3", | ||
"@twilio-paste/theme": "^3.2.26", | ||
"@twilio-paste/types": "^3.0.27" | ||
"@twilio-paste/types": "^3.0.27", | ||
"@twilio-paste/uid-library": "^0.1.0" | ||
}, | ||
"gitHead": "54da8e2ae0c573f9f960772c52f916c366b1343a" | ||
"gitHead": "80d53fb7c313f7a142ee80afddc6f34ec2ed57ec" | ||
} |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
20811
1.08%16
6.67%3
50%