@radix-ui/react-id
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,2 +0,2 @@ | ||
function e(e,r,n){Object.defineProperty(e,r,{get:n,enumerable:!0})}var r,n=require("react"),t=n.createContext,o=n.useContext,i=n.useMemo,u=n.createElement,a=(r=require("@babel/runtime/helpers/extends"))&&r.__esModule?r.default:r,d={};const s={prefix:Math.round(1e10*Math.random()),current:0},c=t(s),l=e=>{const r=o(c),n=r===s,t=i((()=>({prefix:n?0:++r.prefix,current:0})),[n,r]);return u(c.Provider,a({value:t},e))};function p(e){const r=o(c);return Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)||r!==s||console.warn("When server rendering, you must wrap your application in an <IdProvider> to ensure consistent ids are generated between the client and server."),i((()=>e||`radix-id-${r.prefix}-${++r.current}`),[e])}exports.IdProvider=l,exports.useId=p,e(d,"useId",(function(){return p})),e(d,"IdProvider",(function(){return l})); | ||
var e,r,t,n=(e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e),o=(t=require("@babel/runtime/helpers/extends"))&&t.__esModule?t.default:t;const u={prefix:Math.round(1e10*Math.random()),current:0},i=n.createContext(u);exports.IdProvider=e=>{const r=n.useContext(i),t=r===u,a=n.useMemo((()=>({prefix:t?0:++r.prefix,current:0})),[t,r]);return n.createElement(i.Provider,o({value:a},e))},exports.useId=function(e){const r=n.useContext(i);return Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)||r!==u||console.warn("When server rendering, you must wrap your application in an <IdProvider> to ensure consistent ids are generated between the client and server."),n.useMemo((()=>e||`radix-id-${r.prefix}-${++r.current}`),[e])}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
function e(e,r,n){Object.defineProperty(e,r,{get:n,enumerable:!0})}import{createContext as r,useContext as n,useMemo as o,createElement as t}from"react";import i from"@babel/runtime/helpers/esm/extends";var d={};const u={prefix:Math.round(1e10*Math.random()),current:0},a=r(u);export const IdProvider=e=>{const r=n(a),d=r===u,s=o((()=>({prefix:d?0:++r.prefix,current:0})),[d,r]);return t(a.Provider,i({value:s},e))};function s(e){const r=n(a);return Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)||r!==u||console.warn("When server rendering, you must wrap your application in an <IdProvider> to ensure consistent ids are generated between the client and server."),o((()=>e||`radix-id-${r.prefix}-${++r.current}`),[e])}export{s as useId};e(d,"useId",(function(){return s})),e(d,"IdProvider",(function(){return IdProvider})); | ||
import*as e from"react";import r from"@babel/runtime/helpers/esm/extends";const t={prefix:Math.round(1e10*Math.random()),current:0},n=e.createContext(t);export const IdProvider=o=>{const i=e.useContext(n),s=i===t,a=e.useMemo((()=>({prefix:s?0:++i.prefix,current:0})),[s,i]);return e.createElement(n.Provider,r({value:a},o))};export function useId(r){const o=e.useContext(n);return Boolean(null===globalThis||void 0===globalThis?void 0:globalThis.document)||o!==t||console.warn("When server rendering, you must wrap your application in an <IdProvider> to ensure consistent ids are generated between the client and server."),e.useMemo((()=>r||`radix-id-${o.prefix}-${++o.current}`),[r])} | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-id", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "source": "src/index.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9512
13
1