@twilio-paste/aspect-ratio
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -7,3 +7,2 @@ var __create = Object.create; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true }); | ||
var __export = (target, all) => { | ||
@@ -13,18 +12,12 @@ for (var name in all) | ||
}; | ||
var __reExport = (target, module2, copyDefault, desc) => { | ||
if (module2 && typeof module2 === "object" || typeof module2 === "function") { | ||
for (let key of __getOwnPropNames(module2)) | ||
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default")) | ||
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable }); | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return target; | ||
return to; | ||
}; | ||
var __toESM = (module2, isNodeMode) => { | ||
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2); | ||
}; | ||
var __toCommonJS = /* @__PURE__ */ ((cache) => { | ||
return (module2, temp) => { | ||
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp); | ||
}; | ||
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0); | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
@@ -36,2 +29,3 @@ // src/index.tsx | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
var React = __toESM(require("react")); | ||
@@ -88,3 +82,2 @@ var PropTypes = __toESM(require("prop-types")); | ||
} | ||
module.exports = __toCommonJS(src_exports); | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -91,0 +84,0 @@ 0 && (module.exports = { |
@@ -1,2 +0,2 @@ | ||
import*as e from"react";import*as r from"prop-types";import{Box as a}from"@twilio-paste/box";import{styled as n}from"@twilio-paste/styling-library";var p=/^(\d+:\d*)$/,c=t=>p.test(t),d=({ratio:t})=>{if(!(t!=null&&t!==""))throw new Error("[Paste: AspectRatio] Missing 'ratio' prop.");if(!c(t))throw new Error("[Paste: AspectRatio] 'ratio' is invalid. Use a colon separated number pattern (4:3).")},l=n.div` | ||
import*as React from"react";import*as PropTypes from"prop-types";import{Box}from"@twilio-paste/box";import{styled}from"@twilio-paste/styling-library";var RATIO_REGEX=/^(\d+:\d*)$/,isCorrectPattern=ratio=>RATIO_REGEX.test(ratio),handlePropValidation=({ratio})=>{if(!(ratio!=null&&ratio!==""))throw new Error("[Paste: AspectRatio] Missing 'ratio' prop.");if(!isCorrectPattern(ratio))throw new Error("[Paste: AspectRatio] 'ratio' is invalid. Use a colon separated number pattern (4:3).")},AspectRatioContainer=styled.div` | ||
position: relative; | ||
@@ -14,2 +14,2 @@ | ||
} | ||
`,R=e.forwardRef((t,o)=>{d(t);let i=t.ratio.split(":").map(Number),s=i[1]/i[0]*100;return e.createElement(l,{ref:o,style:{paddingBottom:`${s}%`}},e.createElement(a,{position:"absolute",top:0,right:0,bottom:0,left:0},t.children))});R.displayName="AspectRatio";export{R as AspectRatio}; | ||
`,AspectRatio=React.forwardRef((props,ref)=>{handlePropValidation(props);let aspectArray=props.ratio.split(":").map(Number),aspectPercent=aspectArray[1]/aspectArray[0]*100;return React.createElement(AspectRatioContainer,{ref,style:{paddingBottom:`${aspectPercent}%`}},React.createElement(Box,{position:"absolute",top:0,right:0,bottom:0,left:0},props.children))});AspectRatio.displayName="AspectRatio";export{AspectRatio}; |
@@ -1,2 +0,2 @@ | ||
var f=Object.create;var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var n=t=>a(t,"__esModule",{value:!0});var u=(t,e)=>{for(var o in e)a(t,o,{get:e[o],enumerable:!0})},p=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of A(e))!b.call(t,i)&&(o||i!=="default")&&a(t,i,{get:()=>e[i],enumerable:!(s=h(e,i))||s.enumerable});return t},c=(t,e)=>p(n(a(t!=null?f(P(t)):{},"default",!e&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),v=(t=>(e,o)=>t&&t.get(e)||(o=p(n({}),e,1),t&&t.set(e,o),o))(typeof WeakMap!="undefined"?new WeakMap:0);var w={};u(w,{AspectRatio:()=>m});var r=c(require("react")),d=c(require("prop-types")),l=require("@twilio-paste/box"),R=require("@twilio-paste/styling-library"),y=/^(\d+:\d*)$/,g=t=>y.test(t),E=({ratio:t})=>{if(!(t!=null&&t!==""))throw new Error("[Paste: AspectRatio] Missing 'ratio' prop.");if(!g(t))throw new Error("[Paste: AspectRatio] 'ratio' is invalid. Use a colon separated number pattern (4:3).")},N=R.styled.div` | ||
var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};__export(src_exports,{AspectRatio:()=>AspectRatio});module.exports=__toCommonJS(src_exports);var React=__toESM(require("react")),PropTypes=__toESM(require("prop-types")),import_box=require("@twilio-paste/box"),import_styling_library=require("@twilio-paste/styling-library"),RATIO_REGEX=/^(\d+:\d*)$/,isCorrectPattern=ratio=>RATIO_REGEX.test(ratio),handlePropValidation=({ratio})=>{if(!(ratio!=null&&ratio!==""))throw new Error("[Paste: AspectRatio] Missing 'ratio' prop.");if(!isCorrectPattern(ratio))throw new Error("[Paste: AspectRatio] 'ratio' is invalid. Use a colon separated number pattern (4:3).")},AspectRatioContainer=import_styling_library.styled.div` | ||
position: relative; | ||
@@ -14,2 +14,2 @@ | ||
} | ||
`,m=r.forwardRef((t,e)=>{E(t);let o=t.ratio.split(":").map(Number),s=o[1]/o[0]*100;return r.createElement(N,{ref:e,style:{paddingBottom:`${s}%`}},r.createElement(l.Box,{position:"absolute",top:0,right:0,bottom:0,left:0},t.children))});m.displayName="AspectRatio";module.exports=v(w);0&&(module.exports={AspectRatio}); | ||
`,AspectRatio=React.forwardRef((props,ref)=>{handlePropValidation(props);let aspectArray=props.ratio.split(":").map(Number),aspectPercent=aspectArray[1]/aspectArray[0]*100;return React.createElement(AspectRatioContainer,{ref,style:{paddingBottom:`${aspectPercent}%`}},React.createElement(import_box.Box,{position:"absolute",top:0,right:0,bottom:0,left:0},props.children))});AspectRatio.displayName="AspectRatio";0&&(module.exports={AspectRatio}); |
{ | ||
"name": "@twilio-paste/aspect-ratio", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"category": "layout", | ||
@@ -39,8 +39,8 @@ "status": "production", | ||
"devDependencies": { | ||
"@twilio-paste/box": "^6.0.0", | ||
"@twilio-paste/design-tokens": "^7.1.1", | ||
"@twilio-paste/style-props": "^5.0.0", | ||
"@twilio-paste/styling-library": "^1.0.0", | ||
"@twilio-paste/theme": "^7.0.0", | ||
"@twilio-paste/types": "^3.1.5", | ||
"@twilio-paste/box": "^6.0.1", | ||
"@twilio-paste/design-tokens": "^7.3.0", | ||
"@twilio-paste/style-props": "^5.0.2", | ||
"@twilio-paste/styling-library": "^1.0.2", | ||
"@twilio-paste/theme": "^7.0.1", | ||
"@twilio-paste/types": "^3.1.8", | ||
"prop-types": "^15.7.2", | ||
@@ -47,0 +47,0 @@ "react": "^17.0.2", |
Sorry, the diff of this file is not supported yet
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
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
86003
176