Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-aspect-ratio

Package Overview
Dependencies
Maintainers
6
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-aspect-ratio - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0-rc.1

17

dist/index.d.ts

@@ -1,11 +0,12 @@

import * as React from "react";
import * as Radix from "@radix-ui/react-primitive";
import { Primitive } from "@radix-ui/react-primitive";
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
export interface AspectRatioProps extends PrimitiveDivProps {
import * as React from 'react';
import * as Radix from '@radix-ui/react-primitive';
import { Primitive } from '@radix-ui/react-primitive';
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
interface AspectRatioProps extends PrimitiveDivProps {
ratio?: number;
}
export const AspectRatio: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
export const Root: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
declare const AspectRatio: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
declare const Root: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
//# sourceMappingURL=index.d.ts.map
export { AspectRatio, type AspectRatioProps, Root };

@@ -1,52 +0,74 @@

var $frJTO$babelruntimehelpersextends = require("@babel/runtime/helpers/extends");
var $frJTO$react = require("react");
var $frJTO$radixuireactprimitive = require("@radix-ui/react-primitive");
"use strict";
(() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
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 to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "AspectRatio", () => $f950105f8166e93b$export$e840e8869344ca38);
$parcel$export(module.exports, "Root", () => $f950105f8166e93b$export$be92b6f5f03c0fe9);
/* -------------------------------------------------------------------------------------------------
* AspectRatio
* -----------------------------------------------------------------------------------------------*/ const $f950105f8166e93b$var$NAME = 'AspectRatio';
const $f950105f8166e93b$export$e840e8869344ca38 = /*#__PURE__*/ $frJTO$react.forwardRef((props, forwardedRef)=>{
const { ratio: ratio = 1 , style: style , ...aspectRatioProps } = props;
return /*#__PURE__*/ $frJTO$react.createElement("div", {
style: {
// packages/react/aspect-ratio/src/AspectRatio.tsx
var React = __toESM(__require("react"));
var import_react_primitive = __require("@radix-ui/react-primitive");
var import_jsx_runtime = __require("react/jsx-runtime");
var NAME = "AspectRatio";
var AspectRatio = React.forwardRef(
(props, forwardedRef) => {
const { ratio = 1 / 1, style, ...aspectRatioProps } = props;
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"div",
{
style: {
// ensures inner element is contained
position: 'relative',
position: "relative",
// ensures padding bottom trick maths works
width: '100%',
width: "100%",
paddingBottom: `${100 / ratio}%`
},
"data-radix-aspect-ratio-wrapper": ""
}, /*#__PURE__*/ $frJTO$react.createElement($frJTO$radixuireactprimitive.Primitive.div, ($parcel$interopDefault($frJTO$babelruntimehelpersextends))({}, aspectRatioProps, {
ref: forwardedRef,
style: {
...style,
// ensures children expand in ratio
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0
},
"data-radix-aspect-ratio-wrapper": "",
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.div,
{
...aspectRatioProps,
ref: forwardedRef,
style: {
...style,
// ensures children expand in ratio
position: "absolute",
top: 0,
right: 0,
bottom: 0,
left: 0
}
}
)
}
})));
});
/*#__PURE__*/ Object.assign($f950105f8166e93b$export$e840e8869344ca38, {
displayName: $f950105f8166e93b$var$NAME
});
/* -----------------------------------------------------------------------------------------------*/ const $f950105f8166e93b$export$be92b6f5f03c0fe9 = $f950105f8166e93b$export$e840e8869344ca38;
);
}
);
AspectRatio.displayName = NAME;
var Root = AspectRatio;
})();
//# sourceMappingURL=index.js.map
{
"name": "@radix-ui/react-aspect-ratio",
"version": "1.0.3",
"version": "1.1.0-rc.1",
"license": "MIT",

@@ -31,4 +31,3 @@ "exports": {

"dependencies": {
"@babel/runtime": "^7.13.10",
"@radix-ui/react-primitive": "1.0.3"
"@radix-ui/react-primitive": "1.1.0-rc.1"
},

@@ -56,3 +55,4 @@ "peerDependencies": {

"url": "https://github.com/radix-ui/primitives/issues"
}
},
"stableVersion": "1.0.3"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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