@radix-ui/react-id 1.0.1 → 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 CHANGED
@@ -1,3 +1,3 @@
1
- export function useId(deterministicId?: string): string;
1
+ declare function useId(deterministicId?: string): string;
2
2
 
3
- //# sourceMappingURL=index.d.ts.map
3
+ export { useId };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export function useId(deterministicId?: string): string;
1
+ declare function useId(deterministicId?: string): string;
2
2
 
3
- //# sourceMappingURL=index.d.ts.map
3
+ export { useId };
package/dist/index.js CHANGED
@@ -1,28 +1,45 @@
1
- var $47woD$react = require("react");
2
- var $47woD$radixuireactuselayouteffect = require("@radix-ui/react-use-layout-effect");
3
-
4
- function $parcel$export(e, n, v, s) {
5
- Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
6
- }
7
-
8
- $parcel$export(module.exports, "useId", () => $dc478e4659f630c5$export$f680877a34711e37);
9
-
10
-
11
- const $dc478e4659f630c5$var$useReactId = $47woD$react['useId'.toString()] || (()=>undefined
12
- );
13
- let $dc478e4659f630c5$var$count = 0;
14
- function $dc478e4659f630c5$export$f680877a34711e37(deterministicId) {
15
- const [id, setId] = $47woD$react.useState($dc478e4659f630c5$var$useReactId()); // React versions older than 18 will have client-side ids only.
16
- $47woD$radixuireactuselayouteffect.useLayoutEffect(()=>{
17
- if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($dc478e4659f630c5$var$count++)
18
- );
19
- }, [
20
- deterministicId
21
- ]);
22
- return deterministicId || (id ? `radix-${id}` : '');
23
- }
24
-
25
-
26
-
27
-
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
+ ));
31
+
32
+ // packages/react/id/src/id.tsx
33
+ var React = __toESM(__require("react"));
34
+ var import_react_use_layout_effect = __require("@radix-ui/react-use-layout-effect");
35
+ var useReactId = React["useId".toString()] || (() => void 0);
36
+ var count = 0;
37
+ function useId(deterministicId) {
38
+ const [id, setId] = React.useState(useReactId());
39
+ (0, import_react_use_layout_effect.useLayoutEffect)(() => {
40
+ if (!deterministicId) setId((reactId) => reactId ?? String(count++));
41
+ }, [deterministicId]);
42
+ return deterministicId || (id ? `radix-${id}` : "");
43
+ }
44
+ })();
28
45
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1,7 @@
1
- {"mappings":";;;;;;;;ACAA;;AAIA,MAAMG,gCAAU,GAAIF,YAAD,CAAe,OAAA,CAAQG,QAAR,EAAf,CAAA,IAAuC,CAAA,IAAMC,SAA7C;AAAA,CAAA,AAAnB,AAAA;AACA,IAAIC,2BAAK,GAAG,CAAZ,AAAA;AAEA,SAASN,yCAAT,CAAeO,eAAf,EAAiD;IAC/C,MAAM,CAACC,EAAD,EAAKC,KAAL,CAAA,GAAcR,YAAK,CAACS,QAAN,CAAmCP,gCAAU,EAA7C,CAApB,AAD+C,EAE/C,+DADA;IAEAD,kDAAe,CAAC,IAAM;QACpB,IAAI,CAACK,eAAL,EAAsBE,KAAK,CAAEE,CAAAA,OAAD,GAAaA,OAAb,KAAA,IAAA,IAAaA,OAAb,KAAA,KAAA,CAAA,GAAaA,OAAb,GAAwBC,MAAM,CAACN,2BAAK,EAAN,CAA/B;QAAA,CAAL,CAAtB;KADa,EAEZ;QAACC,eAAD;KAFY,CAAf,CAEC;IACD,OAAOA,eAAe,IAAKC,CAAAA,EAAE,GAAI,CAAA,MAAA,EAAQA,EAAG,CAAA,CAAf,GAAmB,EAA1B,CAAA,AAAtB,CAAA;CACD;;ADdD","sources":["packages/react/id/src/index.ts","packages/react/id/src/id.tsx"],"sourcesContent":["export { useId } from './id';\n","import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n// We `toString()` to prevent bundlers from trying to `import { useId } from 'react';`\nconst useReactId = (React as any)['useId'.toString()] || (() => undefined);\nlet count = 0;\n\nfunction useId(deterministicId?: string): string {\n const [id, setId] = React.useState<string | undefined>(useReactId());\n // React versions older than 18 will have client-side ids only.\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : '');\n}\n\nexport { useId };\n"],"names":["useId","React","useLayoutEffect","useReactId","toString","undefined","count","deterministicId","id","setId","useState","reactId","String"],"version":3,"file":"index.js.map"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/id.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n// We `toString()` to prevent bundlers from trying to `import { useId } from 'react';`\nconst useReactId = (React as any)['useId'.toString()] || (() => undefined);\nlet count = 0;\n\nfunction useId(deterministicId?: string): string {\n const [id, setId] = React.useState<string | undefined>(useReactId());\n // React versions older than 18 will have client-side ids only.\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : '');\n}\n\nexport { useId };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,cAAuB;AACvB,uCAAgC;AAGhC,MAAM,aAAc,MAAc,QAAQ,SAAS,CAAC,MAAM,MAAM;AAChE,MAAI,QAAQ;AAEZ,WAAS,MAAM,iBAAkC;AAC/C,UAAM,CAAC,IAAI,KAAK,IAAU,eAA6B,WAAW,CAAC;AAEnE,wDAAgB,MAAM;AACpB,UAAI,CAAC,gBAAiB,OAAM,CAAC,YAAY,WAAW,OAAO,OAAO,CAAC;AAAA,IACrE,GAAG,CAAC,eAAe,CAAC;AACpB,WAAO,oBAAoB,KAAK,SAAS,EAAE,KAAK;AAAA,EAClD;",
6
+ "names": []
7
+ }
package/dist/index.mjs CHANGED
@@ -1,24 +1,16 @@
1
- import * as $2AODx$react from "react";
2
- import {useLayoutEffect as $2AODx$useLayoutEffect} from "@radix-ui/react-use-layout-effect";
3
-
4
-
5
-
6
- const $1746a345f3d73bb7$var$useReactId = $2AODx$react['useId'.toString()] || (()=>undefined
7
- );
8
- let $1746a345f3d73bb7$var$count = 0;
9
- function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
10
- const [id, setId] = $2AODx$react.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
11
- $2AODx$useLayoutEffect(()=>{
12
- if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
13
- );
14
- }, [
15
- deterministicId
16
- ]);
17
- return deterministicId || (id ? `radix-${id}` : '');
1
+ // packages/react/id/src/id.tsx
2
+ import * as React from "react";
3
+ import { useLayoutEffect } from "@radix-ui/react-use-layout-effect";
4
+ var useReactId = React["useId".toString()] || (() => void 0);
5
+ var count = 0;
6
+ function useId(deterministicId) {
7
+ const [id, setId] = React.useState(useReactId());
8
+ useLayoutEffect(() => {
9
+ if (!deterministicId) setId((reactId) => reactId ?? String(count++));
10
+ }, [deterministicId]);
11
+ return deterministicId || (id ? `radix-${id}` : "");
18
12
  }
19
-
20
-
21
-
22
-
23
- export {$1746a345f3d73bb7$export$f680877a34711e37 as useId};
13
+ export {
14
+ useId
15
+ };
24
16
  //# sourceMappingURL=index.mjs.map
@@ -1 +1,7 @@
1
- {"mappings":";;;ACAA;;AAIA,MAAMG,gCAAU,GAAIF,YAAD,CAAe,OAAA,CAAQG,QAAR,EAAf,CAAA,IAAuC,CAAA,IAAMC,SAA7C;AAAA,CAAA,AAAnB,AAAA;AACA,IAAIC,2BAAK,GAAG,CAAZ,AAAA;AAEA,SAASN,yCAAT,CAAeO,eAAf,EAAiD;IAC/C,MAAM,CAACC,EAAD,EAAKC,KAAL,CAAA,GAAcR,YAAK,CAACS,QAAN,CAAmCP,gCAAU,EAA7C,CAApB,AAD+C,EAE/C,+DADA;IAEAD,sBAAe,CAAC,IAAM;QACpB,IAAI,CAACK,eAAL,EAAsBE,KAAK,CAAEE,CAAAA,OAAD,GAAaA,OAAb,KAAA,IAAA,IAAaA,OAAb,KAAA,KAAA,CAAA,GAAaA,OAAb,GAAwBC,MAAM,CAACN,2BAAK,EAAN,CAA/B;QAAA,CAAL,CAAtB;KADa,EAEZ;QAACC,eAAD;KAFY,CAAf,CAEC;IACD,OAAOA,eAAe,IAAKC,CAAAA,EAAE,GAAI,CAAA,MAAA,EAAQA,EAAG,CAAA,CAAf,GAAmB,EAA1B,CAAA,AAAtB,CAAA;CACD;;ADdD","sources":["packages/react/id/src/index.ts","packages/react/id/src/id.tsx"],"sourcesContent":["export { useId } from './id';\n","import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n// We `toString()` to prevent bundlers from trying to `import { useId } from 'react';`\nconst useReactId = (React as any)['useId'.toString()] || (() => undefined);\nlet count = 0;\n\nfunction useId(deterministicId?: string): string {\n const [id, setId] = React.useState<string | undefined>(useReactId());\n // React versions older than 18 will have client-side ids only.\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : '');\n}\n\nexport { useId };\n"],"names":["useId","React","useLayoutEffect","useReactId","toString","undefined","count","deterministicId","id","setId","useState","reactId","String"],"version":3,"file":"index.mjs.map"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/id.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nimport { useLayoutEffect } from '@radix-ui/react-use-layout-effect';\n\n// We `toString()` to prevent bundlers from trying to `import { useId } from 'react';`\nconst useReactId = (React as any)['useId'.toString()] || (() => undefined);\nlet count = 0;\n\nfunction useId(deterministicId?: string): string {\n const [id, setId] = React.useState<string | undefined>(useReactId());\n // React versions older than 18 will have client-side ids only.\n useLayoutEffect(() => {\n if (!deterministicId) setId((reactId) => reactId ?? String(count++));\n }, [deterministicId]);\n return deterministicId || (id ? `radix-${id}` : '');\n}\n\nexport { useId };\n"],
5
+ "mappings": ";AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB;AAGhC,IAAM,aAAc,MAAc,QAAQ,SAAS,CAAC,MAAM,MAAM;AAChE,IAAI,QAAQ;AAEZ,SAAS,MAAM,iBAAkC;AAC/C,QAAM,CAAC,IAAI,KAAK,IAAU,eAA6B,WAAW,CAAC;AAEnE,kBAAgB,MAAM;AACpB,QAAI,CAAC,gBAAiB,OAAM,CAAC,YAAY,WAAW,OAAO,OAAO,CAAC;AAAA,EACrE,GAAG,CAAC,eAAe,CAAC;AACpB,SAAO,oBAAoB,KAAK,SAAS,EAAE,KAAK;AAClD;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radix-ui/react-id",
3
- "version": "1.0.1",
3
+ "version": "1.1.0-rc.1",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": {
@@ -45,7 +45,7 @@
45
45
  "url": "https://github.com/radix-ui/primitives/issues"
46
46
  },
47
47
  "dependencies": {
48
- "@babel/runtime": "^7.13.10",
49
- "@radix-ui/react-use-layout-effect": "1.0.1"
50
- }
48
+ "@radix-ui/react-use-layout-effect": "1.1.0-rc.1"
49
+ },
50
+ "stableVersion": "1.0.1"
51
51
  }
@@ -1 +0,0 @@
1
- {"mappings":"AAOA,sBAAe,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAO/C","sources":["packages/react/id/src/packages/react/id/src/id.tsx","packages/react/id/src/packages/react/id/src/index.ts","packages/react/id/src/index.ts"],"sourcesContent":[null,null,"export { useId } from './id';\n"],"names":[],"version":3,"file":"index.d.ts.map"}