@radix-ui/react-aspect-ratio 1.1.0-rc.1 → 1.1.0-rc.3

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.js CHANGED
@@ -1,74 +1,79 @@
1
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
- ));
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
29
 
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: {
44
- // ensures inner element is contained
45
- position: "relative",
46
- // ensures padding bottom trick maths works
47
- width: "100%",
48
- paddingBottom: `${100 / ratio}%`
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
- }
30
+ // packages/react/aspect-ratio/src/index.ts
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
+ AspectRatio: () => AspectRatio,
34
+ Root: () => Root
35
+ });
36
+ module.exports = __toCommonJS(src_exports);
37
+
38
+ // packages/react/aspect-ratio/src/AspectRatio.tsx
39
+ var React = __toESM(require("react"));
40
+ var import_react_primitive = require("@radix-ui/react-primitive");
41
+ var import_jsx_runtime = require("react/jsx-runtime");
42
+ var NAME = "AspectRatio";
43
+ var AspectRatio = React.forwardRef(
44
+ (props, forwardedRef) => {
45
+ const { ratio = 1 / 1, style, ...aspectRatioProps } = props;
46
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
+ "div",
48
+ {
49
+ style: {
50
+ // ensures inner element is contained
51
+ position: "relative",
52
+ // ensures padding bottom trick maths works
53
+ width: "100%",
54
+ paddingBottom: `${100 / ratio}%`
55
+ },
56
+ "data-radix-aspect-ratio-wrapper": "",
57
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
58
+ import_react_primitive.Primitive.div,
59
+ {
60
+ ...aspectRatioProps,
61
+ ref: forwardedRef,
62
+ style: {
63
+ ...style,
64
+ // ensures children expand in ratio
65
+ position: "absolute",
66
+ top: 0,
67
+ right: 0,
68
+ bottom: 0,
69
+ left: 0
65
70
  }
66
- )
67
- }
68
- );
69
- }
70
- );
71
- AspectRatio.displayName = NAME;
72
- var Root = AspectRatio;
73
- })();
71
+ }
72
+ )
73
+ }
74
+ );
75
+ }
76
+ );
77
+ AspectRatio.displayName = NAME;
78
+ var Root = AspectRatio;
74
79
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
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;",
3
+ "sources": ["../src/index.ts", "../src/AspectRatio.tsx"],
4
+ "sourcesContent": ["export {\n AspectRatio,\n //\n Root,\n} from './AspectRatio';\nexport type { AspectRatioProps } from './AspectRatio';\n", "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;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,6BAA0B;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,iCAAU;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
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-aspect-ratio",
3
- "version": "1.1.0-rc.1",
3
+ "version": "1.1.0-rc.3",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -28,7 +28,7 @@
28
28
  "version": "yarn version"
29
29
  },
30
30
  "dependencies": {
31
- "@radix-ui/react-primitive": "1.1.0-rc.1"
31
+ "@radix-ui/react-primitive": "1.1.0-rc.3"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@types/react": "*",