@radix-ui/react-id 1.0.0 → 1.0.1-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.
@@ -0,0 +1,3 @@
1
+ export function useId(deterministicId?: string): string;
2
+
3
+ //# sourceMappingURL=index.d.ts.map
@@ -21,4 +21,4 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
21
21
 
22
22
 
23
23
  export {$1746a345f3d73bb7$export$f680877a34711e37 as useId};
24
- //# sourceMappingURL=index.module.js.map
24
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
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.module.js.map"}
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"}
package/package.json CHANGED
@@ -1,11 +1,23 @@
1
1
  {
2
2
  "name": "@radix-ui/react-id",
3
- "version": "1.0.0",
3
+ "version": "1.0.1-rc.1",
4
4
  "license": "MIT",
5
- "source": "src/index.ts",
6
- "main": "dist/index.js",
7
- "module": "dist/index.module.js",
8
- "types": "dist/index.d.ts",
5
+ "exports": {
6
+ ".": {
7
+ "import": {
8
+ "types": "./dist/index.d.mts",
9
+ "default": "./dist/index.mjs"
10
+ },
11
+ "require": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ }
15
+ }
16
+ },
17
+ "source": "./src/index.ts",
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.mjs",
20
+ "types": "./dist/index.d.ts",
9
21
  "files": [
10
22
  "dist",
11
23
  "README.md"
@@ -28,6 +40,7 @@
28
40
  },
29
41
  "dependencies": {
30
42
  "@babel/runtime": "^7.13.10",
31
- "@radix-ui/react-use-layout-effect": "1.0.0"
32
- }
43
+ "@radix-ui/react-use-layout-effect": "1.0.1-rc.1"
44
+ },
45
+ "stableVersion": "1.0.0"
33
46
  }