@radix-ui/react-aspect-ratio 1.0.3 → 1.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.js +68 -46
- package/dist/index.js.map +7 -1
- package/dist/index.mjs +43 -41
- package/dist/index.mjs.map +7 -1
- package/package.json +4 -4
- package/dist/index.d.ts.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as Radix from
|
|
3
|
-
import { Primitive } from
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as Radix from '@radix-ui/react-primitive';
|
|
3
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
4
|
+
|
|
5
|
+
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
6
|
+
interface AspectRatioProps extends PrimitiveDivProps {
|
|
6
7
|
ratio?: number;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
declare const AspectRatio: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const Root: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
export { AspectRatio, type AspectRatioProps, Root };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import * as React from
|
|
2
|
-
import * as Radix from
|
|
3
|
-
import { Primitive } from
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as Radix from '@radix-ui/react-primitive';
|
|
3
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
4
|
+
|
|
5
|
+
declare type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
|
|
6
|
+
interface AspectRatioProps extends PrimitiveDivProps {
|
|
6
7
|
ratio?: number;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
declare const AspectRatio: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const Root: React.ForwardRefExoticComponent<AspectRatioProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
export { AspectRatio, type AspectRatioProps, Root };
|
package/dist/index.js
CHANGED
|
@@ -1,52 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
1
|
+
"use strict";
|
|
2
|
+
(() => {
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
4
31
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/* -------------------------------------------------------------------------------------------------
|
|
18
|
-
* AspectRatio
|
|
19
|
-
* -----------------------------------------------------------------------------------------------*/ const $f950105f8166e93b$var$NAME = 'AspectRatio';
|
|
20
|
-
const $f950105f8166e93b$export$e840e8869344ca38 = /*#__PURE__*/ $frJTO$react.forwardRef((props, forwardedRef)=>{
|
|
21
|
-
const { ratio: ratio = 1 , style: style , ...aspectRatioProps } = props;
|
|
22
|
-
return /*#__PURE__*/ $frJTO$react.createElement("div", {
|
|
23
|
-
style: {
|
|
32
|
+
// packages/react/aspect-ratio/src/AspectRatio.tsx
|
|
33
|
+
var React = __toESM(__require("react"));
|
|
34
|
+
var import_react_primitive = __require("@radix-ui/react-primitive");
|
|
35
|
+
var import_jsx_runtime = __require("react/jsx-runtime");
|
|
36
|
+
var NAME = "AspectRatio";
|
|
37
|
+
var AspectRatio = React.forwardRef(
|
|
38
|
+
(props, forwardedRef) => {
|
|
39
|
+
const { ratio = 1 / 1, style, ...aspectRatioProps } = props;
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
style: {
|
|
24
44
|
// ensures inner element is contained
|
|
25
|
-
position:
|
|
45
|
+
position: "relative",
|
|
26
46
|
// ensures padding bottom trick maths works
|
|
27
|
-
width:
|
|
47
|
+
width: "100%",
|
|
28
48
|
paddingBottom: `${100 / ratio}%`
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
},
|
|
50
|
+
"data-radix-aspect-ratio-wrapper": "",
|
|
51
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
52
|
+
import_react_primitive.Primitive.div,
|
|
53
|
+
{
|
|
54
|
+
...aspectRatioProps,
|
|
55
|
+
ref: forwardedRef,
|
|
56
|
+
style: {
|
|
57
|
+
...style,
|
|
58
|
+
// ensures children expand in ratio
|
|
59
|
+
position: "absolute",
|
|
60
|
+
top: 0,
|
|
61
|
+
right: 0,
|
|
62
|
+
bottom: 0,
|
|
63
|
+
left: 0
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
)
|
|
41
67
|
}
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
AspectRatio.displayName = NAME;
|
|
72
|
+
var Root = AspectRatio;
|
|
73
|
+
})();
|
|
52
74
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/AspectRatio.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * AspectRatio\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'AspectRatio';\n\ntype AspectRatioElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface AspectRatioProps extends PrimitiveDivProps {\n ratio?: number;\n}\n\nconst AspectRatio = React.forwardRef<AspectRatioElement, AspectRatioProps>(\n (props, forwardedRef) => {\n const { ratio = 1 / 1, style, ...aspectRatioProps } = props;\n return (\n <div\n style={{\n // ensures inner element is contained\n position: 'relative',\n // ensures padding bottom trick maths works\n width: '100%',\n paddingBottom: `${100 / ratio}%`,\n }}\n data-radix-aspect-ratio-wrapper=\"\"\n >\n <Primitive.div\n {...aspectRatioProps}\n ref={forwardedRef}\n style={{\n ...style,\n // ensures children expand in ratio\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }}\n />\n </div>\n );\n }\n);\n\nAspectRatio.displayName = NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = AspectRatio;\n\nexport {\n AspectRatio,\n //\n Root,\n};\nexport type { AspectRatioProps };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAuB;AACvB,+BAA0B;AA8BlB;AAtBR,MAAM,OAAO;AAQb,MAAM,cAAoB;AAAA,IACxB,CAAC,OAAO,iBAAiB;AACvB,YAAM,EAAE,QAAQ,IAAI,GAAG,OAAO,GAAG,iBAAiB,IAAI;AACtD,aACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA;AAAA,YAEL,UAAU;AAAA;AAAA,YAEV,OAAO;AAAA,YACP,eAAe,GAAG,MAAM,KAAK;AAAA,UAC/B;AAAA,UACA,mCAAgC;AAAA,UAEhC;AAAA,YAAC,iCAAU;AAAA,YAAV;AAAA,cACE,GAAG;AAAA,cACJ,KAAK;AAAA,cACL,OAAO;AAAA,gBACL,GAAG;AAAA;AAAA,gBAEH,UAAU;AAAA,gBACV,KAAK;AAAA,gBACL,OAAO;AAAA,gBACP,QAAQ;AAAA,gBACR,MAAM;AAAA,cACR;AAAA;AAAA,UACF;AAAA;AAAA,MACF;AAAA,IAEJ;AAAA,EACF;AAEA,cAAY,cAAc;AAI1B,MAAM,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import {Primitive
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const { ratio: ratio = 1 , style: style , ...aspectRatioProps } = props;
|
|
13
|
-
return /*#__PURE__*/ $8D4cD$createElement("div", {
|
|
1
|
+
// packages/react/aspect-ratio/src/AspectRatio.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Primitive } from "@radix-ui/react-primitive";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var NAME = "AspectRatio";
|
|
6
|
+
var AspectRatio = React.forwardRef(
|
|
7
|
+
(props, forwardedRef) => {
|
|
8
|
+
const { ratio = 1 / 1, style, ...aspectRatioProps } = props;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"div",
|
|
11
|
+
{
|
|
14
12
|
style: {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
// ensures inner element is contained
|
|
14
|
+
position: "relative",
|
|
15
|
+
// ensures padding bottom trick maths works
|
|
16
|
+
width: "100%",
|
|
17
|
+
paddingBottom: `${100 / ratio}%`
|
|
20
18
|
},
|
|
21
|
-
"data-radix-aspect-ratio-wrapper": ""
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
...
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
19
|
+
"data-radix-aspect-ratio-wrapper": "",
|
|
20
|
+
children: /* @__PURE__ */ jsx(
|
|
21
|
+
Primitive.div,
|
|
22
|
+
{
|
|
23
|
+
...aspectRatioProps,
|
|
24
|
+
ref: forwardedRef,
|
|
25
|
+
style: {
|
|
26
|
+
...style,
|
|
27
|
+
// ensures children expand in ratio
|
|
28
|
+
position: "absolute",
|
|
29
|
+
top: 0,
|
|
30
|
+
right: 0,
|
|
31
|
+
bottom: 0,
|
|
32
|
+
left: 0
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
AspectRatio.displayName = NAME;
|
|
41
|
+
var Root = AspectRatio;
|
|
42
|
+
export {
|
|
43
|
+
AspectRatio,
|
|
44
|
+
Root
|
|
45
|
+
};
|
|
44
46
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/AspectRatio.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type * as Radix from '@radix-ui/react-primitive';\n\n/* -------------------------------------------------------------------------------------------------\n * AspectRatio\n * -----------------------------------------------------------------------------------------------*/\n\nconst NAME = 'AspectRatio';\n\ntype AspectRatioElement = React.ElementRef<typeof Primitive.div>;\ntype PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface AspectRatioProps extends PrimitiveDivProps {\n ratio?: number;\n}\n\nconst AspectRatio = React.forwardRef<AspectRatioElement, AspectRatioProps>(\n (props, forwardedRef) => {\n const { ratio = 1 / 1, style, ...aspectRatioProps } = props;\n return (\n <div\n style={{\n // ensures inner element is contained\n position: 'relative',\n // ensures padding bottom trick maths works\n width: '100%',\n paddingBottom: `${100 / ratio}%`,\n }}\n data-radix-aspect-ratio-wrapper=\"\"\n >\n <Primitive.div\n {...aspectRatioProps}\n ref={forwardedRef}\n style={{\n ...style,\n // ensures children expand in ratio\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n }}\n />\n </div>\n );\n }\n);\n\nAspectRatio.displayName = NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nconst Root = AspectRatio;\n\nexport {\n AspectRatio,\n //\n Root,\n};\nexport type { AspectRatioProps };\n"],
|
|
5
|
+
"mappings": ";AAAA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AA8BlB;AAtBR,IAAM,OAAO;AAQb,IAAM,cAAoB;AAAA,EACxB,CAAC,OAAO,iBAAiB;AACvB,UAAM,EAAE,QAAQ,IAAI,GAAG,OAAO,GAAG,iBAAiB,IAAI;AACtD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA;AAAA,UAEL,UAAU;AAAA;AAAA,UAEV,OAAO;AAAA,UACP,eAAe,GAAG,MAAM,KAAK;AAAA,QAC/B;AAAA,QACA,mCAAgC;AAAA,QAEhC;AAAA,UAAC,UAAU;AAAA,UAAV;AAAA,YACE,GAAG;AAAA,YACJ,KAAK;AAAA,YACL,OAAO;AAAA,cACL,GAAG;AAAA;AAAA,cAEH,UAAU;AAAA,cACV,KAAK;AAAA,cACL,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,MAAM;AAAA,YACR;AAAA;AAAA,QACF;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;AAI1B,IAAM,OAAO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-aspect-ratio",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
"version": "yarn version"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@radix-ui/react-primitive": "1.0.3"
|
|
31
|
+
"@radix-ui/react-primitive": "1.1.0-rc.1"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
34
|
"@types/react": "*",
|
|
@@ -52,5 +51,6 @@
|
|
|
52
51
|
},
|
|
53
52
|
"bugs": {
|
|
54
53
|
"url": "https://github.com/radix-ui/primitives/issues"
|
|
55
|
-
}
|
|
54
|
+
},
|
|
55
|
+
"stableVersion": "1.0.3"
|
|
56
56
|
}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;AAYA,yBAAyB,MAAM,wBAAwB,CAAC,OAAO,UAAU,GAAG,CAAC,CAAC;AAC9E,iCAA2B,SAAQ,iBAAiB;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,OAAA,MAAM,oGA8BL,CAAC;AAMF,OAAA,MAAM,6FAAkB,CAAC","sources":["packages/react/aspect-ratio/src/packages/react/aspect-ratio/src/AspectRatio.tsx","packages/react/aspect-ratio/src/packages/react/aspect-ratio/src/index.ts","packages/react/aspect-ratio/src/index.ts"],"sourcesContent":[null,null,"export {\n AspectRatio,\n //\n Root,\n} from './AspectRatio';\nexport type { AspectRatioProps } from './AspectRatio';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|