@twilio-paste/flex
Advanced tools
Comparing version 0.3.6 to 0.3.7
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.3.7](https://github.com/twilio-labs/paste/compare/@twilio-paste/flex@0.3.6...@twilio-paste/flex@0.3.7) (2020-03-17) | ||
**Note:** Version bump only for package @twilio-paste/flex | ||
## [0.3.6](https://github.com/twilio-labs/paste/compare/@twilio-paste/flex@0.3.5...@twilio-paste/flex@0.3.6) (2020-03-11) | ||
@@ -8,0 +16,0 @@ |
import * as React from 'react'; | ||
import { ResponsiveValue } from 'styled-system'; | ||
import { LayoutProps, MarginProps, PaddingProps } from '@twilio-paste/style-props'; | ||
declare type DisplayOptions = 'flex' | 'inline-flex'; | ||
export declare type Display = ResponsiveValue<DisplayOptions>; | ||
declare type VerticalAlignOptions = 'top' | 'center' | 'bottom' | 'stretch'; | ||
export declare type VerticalAlign = ResponsiveValue<VerticalAlignOptions>; | ||
declare type HorizontalAlignOptions = 'left' | 'center' | 'right' | 'around' | 'between'; | ||
export declare type HorizontalAlign = ResponsiveValue<HorizontalAlignOptions>; | ||
declare type VerticalOptions = boolean; | ||
export declare type Vertical = ResponsiveValue<VerticalOptions>; | ||
declare type GrowOptions = boolean | number; | ||
export declare type Grow = ResponsiveValue<GrowOptions>; | ||
declare type ShrinkOptions = boolean | number; | ||
export declare type Shrink = ResponsiveValue<ShrinkOptions>; | ||
declare type BasisOptions = string | number; | ||
export declare type Basis = ResponsiveValue<BasisOptions>; | ||
declare type WrapOptions = boolean; | ||
export declare type Wrap = ResponsiveValue<WrapOptions>; | ||
export interface FlexProps extends LayoutProps, MarginProps, PaddingProps { | ||
as?: keyof JSX.IntrinsicElements; | ||
display?: Display; | ||
vertical?: Vertical; | ||
vAlignContent?: VerticalAlign; | ||
hAlignContent?: HorizontalAlign; | ||
grow?: Grow; | ||
shrink?: Shrink; | ||
basis?: Basis; | ||
wrap?: Wrap; | ||
} | ||
export declare const getGrow: ({ grow }: FlexProps) => {}; | ||
export declare const getShrink: ({ shrink, basis }: FlexProps) => {}; | ||
export declare const getSuffix: (item: ResponsiveValue<string | number, Required<import("styled-system").Theme<string | number>>>) => {}; | ||
export declare const getBasis: ({ basis }: FlexProps) => {}; | ||
export declare const getVertical: ({ vertical }: FlexProps) => {}; | ||
export declare const getWrap: ({ wrap }: FlexProps) => {}; | ||
export declare const vAlignToProps: ({ vAlignContent }: FlexProps) => {}; | ||
export declare const hAlignToProps: ({ hAlignContent }: FlexProps) => {}; | ||
import { FlexProps } from './types'; | ||
declare const Flex: React.FC<FlexProps>; | ||
export { Flex }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import{useMemo as r,createElement as t}from"react";import{string as n,oneOfType as e,oneOf as i,arrayOf as a,bool as o,number as p}from"prop-types";import{Box as l,safelySpreadBoxProps as f}from"@twilio-paste/box"; | ||
import{useMemo as r,createElement as t}from"react";import{string as n,oneOf as e,bool as i,oneOfType as a,number as o}from"prop-types";import{Box as p,safelySpreadBoxProps as l}from"@twilio-paste/box";import{ResponsiveProp as s}from"@twilio-paste/style-props"; | ||
/*! ***************************************************************************** | ||
@@ -15,2 +15,2 @@ Copyright (c) Microsoft Corporation. All rights reserved. | ||
and limitations under the License. | ||
***************************************************************************** */var s=function(){return(s=Object.assign||function(r){for(var t,n=1,e=arguments.length;n<e;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r}).apply(this,arguments)};var u=function(r){var t=r.grow;return Array.isArray(t)?t.map((function(r){return Number(r)})):"number"==typeof t?t:t?1:0},c=function(r){var t=r.shrink,n=r.basis;return Array.isArray(t)?t.map((function(r){return Number(r)})):"number"==typeof t?t:"boolean"==typeof t?t?1:0:n&&"auto"!==n?0:1},g=function(r){return r+("number"==typeof r||String(parseInt(r,10))===r?"px":"")},m=function(r){var t=r.basis;return Array.isArray(t)?t.map((function(r){return g(r)})):t?g(t):"auto"},d=function(r){var t=r.vertical;return Array.isArray(t)?t.map((function(r){return"boolean"==typeof r?!0===r?"column":"row":r})):t?"column":"row"},h=function(r){var t=r.wrap;return Array.isArray(t)?t.map((function(r){return"boolean"==typeof r?!0===r?"wrap":"nowrap":r})):t?"wrap":"nowrap"},y={top:"flex-start",center:"center",bottom:"flex-end",stretch:"stretch"},b=function(r){var t=r.vAlignContent;return Array.isArray(t)?t.map((function(r){return y[r]})):t?y[t]:"flex-start"},w={left:"flex-start",center:"center",right:"flex-end",around:"space-around",between:"space-between"},v=function(r){var t=r.hAlignContent;return Array.isArray(t)?t.map((function(r){return w[r]})):t?w[t]:"flex-start"},x=function(n){var e=n.as,i=n.basis,a=n.children,o=n.display,p=n.hAlignContent,g=n.grow,y=n.marginTop,w=n.marginRight,x=n.marginBottom,A=n.marginLeft,O=n.paddingTop,C=n.paddingRight,j=n.paddingBottom,k=n.paddingLeft,B=n.maxWidth,T=n.minWidth,W=n.shrink,L=n.vertical,R=n.vAlignContent,P=n.width,S=n.wrap,I=function(r,t){var n={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&t.indexOf(e)<0&&(n[e]=r[e]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(e=Object.getOwnPropertySymbols(r);i<e.length;i++)t.indexOf(e[i])<0&&Object.prototype.propertyIsEnumerable.call(r,e[i])&&(n[e[i]]=r[e[i]])}return n}(n,["as","basis","children","display","hAlignContent","grow","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","maxWidth","minWidth","shrink","vertical","vAlignContent","width","wrap"]),N=r((function(){return function(r){var t={justifyContent:r.vertical?b(r):v(r),alignItems:r.vertical?v(r):b(r)};return(r.grow||r.shrink||r.basis)&&(t.flexGrow=u(r),t.flexShrink=c(r),t.flexBasis=m(r)),r.vertical&&(t.flexDirection=d(r)),r.wrap&&(t.flexWrap=h(r)),t}({basis:i,hAlignContent:p,grow:g,shrink:W,vertical:L,vAlignContent:R,wrap:S})}),[i,p,g,W,L,R,S]);return t(l,s({},N,f(I),{as:e,display:o,marginTop:y,marginRight:w,marginBottom:x,marginLeft:A,paddingTop:O,paddingRight:C,paddingBottom:j,paddingLeft:k,maxWidth:B,minWidth:T,width:P}),a)};x.propTypes={as:n,display:e([i(["flex","inline-flex"]),a(i(["flex","inline-flex"]))]),vertical:e([e([o]),a(e([o]))]),vAlignContent:e([i(["top","center","bottom","stretch"]),a(i(["top","center","bottom","stretch"]))]),hAlignContent:e([i(["left","center","right","around","between"]),a(i(["left","center","right","around","between"]))]),grow:e([e([o,p]),a(e([o,p]))]),shrink:e([e([o,p]),a(e([o,p]))]),basis:e([e([n,p]),a(e([n,p]))]),wrap:e([e([o]),a(e([o]))])},x.defaultProps={display:"flex"},x.displayName="Flex";export{x as Flex,m as getBasis,u as getGrow,c as getShrink,g as getSuffix,d as getVertical,h as getWrap,v as hAlignToProps,b as vAlignToProps}; | ||
***************************************************************************** */var f=function(){return(f=Object.assign||function(r){for(var t,n=1,e=arguments.length;n<e;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=t[i]);return r}).apply(this,arguments)};var u=function(r){return r+("number"==typeof r||String(parseInt(r,10))===r?"px":"")},c={top:"flex-start",center:"center",bottom:"flex-end",stretch:"stretch"},g=function(r){var t=r.vAlignContent;return Array.isArray(t)?t.map((function(r){return c[r]})):t?c[t]:"flex-start"},m={left:"flex-start",center:"center",right:"flex-end",around:"space-around",between:"space-between"},d=function(r){var t=r.hAlignContent;return Array.isArray(t)?t.map((function(r){return m[r]})):t?m[t]:"flex-start"},y=function(r){var t,n={justifyContent:r.vertical?g(r):d(r),alignItems:r.vertical?d(r):g(r)};return(r.grow||r.shrink||r.basis)&&(n.flexGrow=(t=r.grow,Array.isArray(t)?t.map((function(r){return Number(r)})):"number"==typeof t?t:t?1:0),n.flexShrink=function(r){var t=r.shrink,n=r.basis;return Array.isArray(t)?t.map((function(r){return Number(r)})):"number"==typeof t?t:"boolean"==typeof t?t?1:0:n&&"auto"!==n?0:1}(r),n.flexBasis=function(r){var t=r.basis;return Array.isArray(t)?t.map((function(r){return u(r)})):t?u(t):"auto"}(r)),r.vertical&&(n.flexDirection=function(r){var t=r.vertical;return Array.isArray(t)?t.map((function(r){return"boolean"==typeof r?!0===r?"column":"row":r})):t?"column":"row"}(r)),r.wrap&&(n.flexWrap=function(r){var t=r.wrap;return Array.isArray(t)?t.map((function(r){return"boolean"==typeof r?!0===r?"wrap":"nowrap":r})):t?"wrap":"nowrap"}(r)),n},h=function(n){var e=n.as,i=n.basis,a=n.children,o=n.display,s=n.hAlignContent,u=n.grow,c=n.marginTop,g=n.marginRight,m=n.marginBottom,d=n.marginLeft,h=n.paddingTop,w=n.paddingRight,b=n.paddingBottom,v=n.paddingLeft,A=n.maxWidth,x=n.minWidth,O=n.shrink,C=n.vertical,j=n.vAlignContent,k=n.width,B=n.wrap,T=function(r,t){var n={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&t.indexOf(e)<0&&(n[e]=r[e]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(e=Object.getOwnPropertySymbols(r);i<e.length;i++)t.indexOf(e[i])<0&&Object.prototype.propertyIsEnumerable.call(r,e[i])&&(n[e[i]]=r[e[i]])}return n}(n,["as","basis","children","display","hAlignContent","grow","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","maxWidth","minWidth","shrink","vertical","vAlignContent","width","wrap"]),W=r((function(){return y({basis:i,hAlignContent:s,grow:u,shrink:O,vertical:C,vAlignContent:j,wrap:B})}),[i,s,u,O,C,j,B]);return t(p,f({},W,l(T),{as:e,display:o,marginTop:c,marginRight:g,marginBottom:m,marginLeft:d,paddingTop:h,paddingRight:w,paddingBottom:b,paddingLeft:v,maxWidth:A,minWidth:x,width:k}),a)};h.displayName="Flex",h.defaultProps={display:"flex"},"development"===process.env.NODE_ENV&&(h.propTypes={as:n,display:s(e(["flex","inline-flex"])),vertical:s(i),vAlignContent:s(e(["top","center","bottom","stretch"])),hAlignContent:s(e(["left","center","right","around","between"])),grow:s(a([i,o])),shrink:s(a([i,o])),basis:s(a([n,o])),wrap:s(i)});export{h as Flex}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react"),e=require("prop-types"),n=require("@twilio-paste/box"),t=function(){return(t=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}).apply(this,arguments)};var o=function(r){var e=r.grow;return Array.isArray(e)?e.map((function(r){return Number(r)})):"number"==typeof e?e:e?1:0},a=function(r){var e=r.shrink,n=r.basis;return Array.isArray(e)?e.map((function(r){return Number(r)})):"number"==typeof e?e:"boolean"==typeof e?e?1:0:n&&"auto"!==n?0:1},i=function(r){return r+("number"==typeof r||String(parseInt(r,10))===r?"px":"")},p=function(r){var e=r.basis;return Array.isArray(e)?e.map((function(r){return i(r)})):e?i(e):"auto"},f=function(r){var e=r.vertical;return Array.isArray(e)?e.map((function(r){return"boolean"==typeof r?!0===r?"column":"row":r})):e?"column":"row"},s=function(r){var e=r.wrap;return Array.isArray(e)?e.map((function(r){return"boolean"==typeof r?!0===r?"wrap":"nowrap":r})):e?"wrap":"nowrap"},l={top:"flex-start",center:"center",bottom:"flex-end",stretch:"stretch"},u=function(r){var e=r.vAlignContent;return Array.isArray(e)?e.map((function(r){return l[r]})):e?l[e]:"flex-start"},y={left:"flex-start",center:"center",right:"flex-end",around:"space-around",between:"space-between"},g=function(r){var e=r.hAlignContent;return Array.isArray(e)?e.map((function(r){return y[r]})):e?y[e]:"flex-start"},c=function(e){var i=e.as,l=e.basis,y=e.children,c=e.display,m=e.hAlignContent,d=e.grow,b=e.marginTop,O=e.marginRight,h=e.marginBottom,x=e.marginLeft,w=e.paddingTop,v=e.paddingRight,T=e.paddingBottom,A=e.paddingLeft,C=e.maxWidth,B=e.minWidth,P=e.shrink,j=e.vertical,k=e.vAlignContent,W=e.width,S=e.wrap,L=function(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(r);o<t.length;o++)e.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(r,t[o])&&(n[t[o]]=r[t[o]])}return n}(e,["as","basis","children","display","hAlignContent","grow","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","maxWidth","minWidth","shrink","vertical","vAlignContent","width","wrap"]),R=r.useMemo((function(){return function(r){var e={justifyContent:r.vertical?u(r):g(r),alignItems:r.vertical?g(r):u(r)};return(r.grow||r.shrink||r.basis)&&(e.flexGrow=o(r),e.flexShrink=a(r),e.flexBasis=p(r)),r.vertical&&(e.flexDirection=f(r)),r.wrap&&(e.flexWrap=s(r)),e}({basis:l,hAlignContent:m,grow:d,shrink:P,vertical:j,vAlignContent:k,wrap:S})}),[l,m,d,P,j,k,S]);return r.createElement(n.Box,t({},R,n.safelySpreadBoxProps(L),{as:i,display:c,marginTop:b,marginRight:O,marginBottom:h,marginLeft:x,paddingTop:w,paddingRight:v,paddingBottom:T,paddingLeft:A,maxWidth:C,minWidth:B,width:W}),y)};c.propTypes={as:e.string,display:e.oneOfType([e.oneOf(["flex","inline-flex"]),e.arrayOf(e.oneOf(["flex","inline-flex"]))]),vertical:e.oneOfType([e.oneOfType([e.bool]),e.arrayOf(e.oneOfType([e.bool]))]),vAlignContent:e.oneOfType([e.oneOf(["top","center","bottom","stretch"]),e.arrayOf(e.oneOf(["top","center","bottom","stretch"]))]),hAlignContent:e.oneOfType([e.oneOf(["left","center","right","around","between"]),e.arrayOf(e.oneOf(["left","center","right","around","between"]))]),grow:e.oneOfType([e.oneOfType([e.bool,e.number]),e.arrayOf(e.oneOfType([e.bool,e.number]))]),shrink:e.oneOfType([e.oneOfType([e.bool,e.number]),e.arrayOf(e.oneOfType([e.bool,e.number]))]),basis:e.oneOfType([e.oneOfType([e.string,e.number]),e.arrayOf(e.oneOfType([e.string,e.number]))]),wrap:e.oneOfType([e.oneOfType([e.bool]),e.arrayOf(e.oneOfType([e.bool]))])},c.defaultProps={display:"flex"},c.displayName="Flex",exports.Flex=c,exports.getBasis=p,exports.getGrow=o,exports.getShrink=a,exports.getSuffix=i,exports.getVertical=f,exports.getWrap=s,exports.hAlignToProps=g,exports.vAlignToProps=u; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("react"),e=require("prop-types"),n=require("@twilio-paste/box"),t=require("@twilio-paste/style-props"),o=function(){return(o=Object.assign||function(r){for(var e,n=1,t=arguments.length;n<t;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}).apply(this,arguments)};var i=function(r){return r+("number"==typeof r||String(parseInt(r,10))===r?"px":"")},a={top:"flex-start",center:"center",bottom:"flex-end",stretch:"stretch"},p=function(r){var e=r.vAlignContent;return Array.isArray(e)?e.map((function(r){return a[r]})):e?a[e]:"flex-start"},s={left:"flex-start",center:"center",right:"flex-end",around:"space-around",between:"space-between"},l=function(r){var e=r.hAlignContent;return Array.isArray(e)?e.map((function(r){return s[r]})):e?s[e]:"flex-start"},u=function(r){var e,n={justifyContent:r.vertical?p(r):l(r),alignItems:r.vertical?l(r):p(r)};return(r.grow||r.shrink||r.basis)&&(n.flexGrow=(e=r.grow,Array.isArray(e)?e.map((function(r){return Number(r)})):"number"==typeof e?e:e?1:0),n.flexShrink=function(r){var e=r.shrink,n=r.basis;return Array.isArray(e)?e.map((function(r){return Number(r)})):"number"==typeof e?e:"boolean"==typeof e?e?1:0:n&&"auto"!==n?0:1}(r),n.flexBasis=function(r){var e=r.basis;return Array.isArray(e)?e.map((function(r){return i(r)})):e?i(e):"auto"}(r)),r.vertical&&(n.flexDirection=function(r){var e=r.vertical;return Array.isArray(e)?e.map((function(r){return"boolean"==typeof r?!0===r?"column":"row":r})):e?"column":"row"}(r)),r.wrap&&(n.flexWrap=function(r){var e=r.wrap;return Array.isArray(e)?e.map((function(r){return"boolean"==typeof r?!0===r?"wrap":"nowrap":r})):e?"wrap":"nowrap"}(r)),n},f=function(e){var t=e.as,i=e.basis,a=e.children,p=e.display,s=e.hAlignContent,l=e.grow,f=e.marginTop,c=e.marginRight,g=e.marginBottom,d=e.marginLeft,m=e.paddingTop,y=e.paddingRight,h=e.paddingBottom,v=e.paddingLeft,b=e.maxWidth,w=e.minWidth,x=e.shrink,A=e.vertical,O=e.vAlignContent,P=e.width,R=e.wrap,C=function(r,e){var n={};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&e.indexOf(t)<0&&(n[t]=r[t]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(t=Object.getOwnPropertySymbols(r);o<t.length;o++)e.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(r,t[o])&&(n[t[o]]=r[t[o]])}return n}(e,["as","basis","children","display","hAlignContent","grow","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","maxWidth","minWidth","shrink","vertical","vAlignContent","width","wrap"]),T=r.useMemo((function(){return u({basis:i,hAlignContent:s,grow:l,shrink:x,vertical:A,vAlignContent:O,wrap:R})}),[i,s,l,x,A,O,R]);return r.createElement(n.Box,o({},T,n.safelySpreadBoxProps(C),{as:t,display:p,marginTop:f,marginRight:c,marginBottom:g,marginLeft:d,paddingTop:m,paddingRight:y,paddingBottom:h,paddingLeft:v,maxWidth:b,minWidth:w,width:P}),a)};f.displayName="Flex",f.defaultProps={display:"flex"},"development"===process.env.NODE_ENV&&(f.propTypes={as:e.string,display:t.ResponsiveProp(e.oneOf(["flex","inline-flex"])),vertical:t.ResponsiveProp(e.bool),vAlignContent:t.ResponsiveProp(e.oneOf(["top","center","bottom","stretch"])),hAlignContent:t.ResponsiveProp(e.oneOf(["left","center","right","around","between"])),grow:t.ResponsiveProp(e.oneOfType([e.bool,e.number])),shrink:t.ResponsiveProp(e.oneOfType([e.bool,e.number])),basis:t.ResponsiveProp(e.oneOfType([e.string,e.number])),wrap:t.ResponsiveProp(e.bool)}),exports.Flex=f; |
{ | ||
"name": "@twilio-paste/flex", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"category": "layout", | ||
@@ -47,5 +47,5 @@ "status": "beta", | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"@twilio-paste/box": "^2.2.1", | ||
"@twilio-paste/box": "^2.2.2", | ||
"@twilio-paste/design-tokens": "^4.3.0", | ||
"@twilio-paste/style-props": "^0.1.12", | ||
"@twilio-paste/style-props": "^0.2.0", | ||
"@twilio-paste/theme-tokens": "^3.1.2", | ||
@@ -64,3 +64,3 @@ "csstype": "^2.6.6", | ||
}, | ||
"gitHead": "a2a657e7dbd4dc6a84538c9b8d9ecec3a54c1ce4" | ||
"gitHead": "e4a78755803b974c69f923fc71dff12bc746587b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
201180
12
7192
0
3