@mirohq/design-system-use-id
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -16,3 +16,3 @@ 'use strict'; | ||
const useId = (id) => { | ||
const [interalId, setId] = React.useState(id != null ? id : getReactId()); | ||
const [internalId, setId] = React.useState(id != null ? id : getReactId()); | ||
designSystemUseLayoutEffect.useLayoutEffect(() => { | ||
@@ -23,3 +23,3 @@ if (id === "" || id === void 0) { | ||
}, [id]); | ||
return id != null ? id : interalId !== void 0 ? "mds-".concat(interalId) : ""; | ||
return id != null ? id : internalId !== void 0 ? "mds-".concat(internalId) : ""; | ||
}; | ||
@@ -26,0 +26,0 @@ |
@@ -8,3 +8,3 @@ import React, { useState } from 'react'; | ||
const useId = (id) => { | ||
const [interalId, setId] = useState(id != null ? id : getReactId()); | ||
const [internalId, setId] = useState(id != null ? id : getReactId()); | ||
useLayoutEffect(() => { | ||
@@ -15,3 +15,3 @@ if (id === "" || id === void 0) { | ||
}, [id]); | ||
return id != null ? id : interalId !== void 0 ? "mds-".concat(interalId) : ""; | ||
return id != null ? id : internalId !== void 0 ? "mds-".concat(internalId) : ""; | ||
}; | ||
@@ -18,0 +18,0 @@ |
@@ -0,3 +1,11 @@ | ||
/** | ||
* Generates a unique id for an element. | ||
* @param id - The id to use, if provided. | ||
* @returns The id to use | ||
* @example | ||
* const id = useId() // 'mds-1' | ||
* const id = useId('custom-id') // 'custom-id ' | ||
*/ | ||
declare const useId: (id?: string) => string; | ||
export { useId }; |
{ | ||
"name": "@mirohq/design-system-use-id", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "author": "Miro", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
5960
46