@mirohq/design-system-utils
Advanced tools
Comparing version
@@ -35,2 +35,11 @@ 'use strict'; | ||
}; | ||
const mergeRefs = (refs) => (value) => { | ||
refs.forEach((ref) => { | ||
if (typeof ref === "function") { | ||
ref(value); | ||
} else if (ref != null) { | ||
ref.current = value; | ||
} | ||
}); | ||
}; | ||
@@ -62,2 +71,3 @@ const mapKeysToVariants = (map, prop) => Object.keys(map).reduce((acc, key) => { | ||
exports.mapKeysToVariants = mapKeysToVariants; | ||
exports.mergeRefs = mergeRefs; | ||
//# sourceMappingURL=main.js.map |
@@ -31,2 +31,11 @@ import { Fragment, Children, cloneElement } from 'react'; | ||
}; | ||
const mergeRefs = (refs) => (value) => { | ||
refs.forEach((ref) => { | ||
if (typeof ref === "function") { | ||
ref(value); | ||
} else if (ref != null) { | ||
ref.current = value; | ||
} | ||
}); | ||
}; | ||
@@ -53,3 +62,3 @@ const mapKeysToVariants = (map, prop) => Object.keys(map).reduce((acc, key) => { | ||
export { addPropsToChildren, booleanify, createConstants, isFragment, mapKeysToVariants }; | ||
export { addPropsToChildren, booleanify, createConstants, isFragment, mapKeysToVariants, mergeRefs }; | ||
//# sourceMappingURL=module.js.map |
@@ -0,1 +1,2 @@ | ||
import * as react from 'react'; | ||
import { ReactNode, ReactElement } from 'react'; | ||
@@ -17,2 +18,8 @@ import * as _stitches_react_types_css_util from '@stitches/react/types/css-util'; | ||
declare const addPropsToChildren: <T>(children: ReactNode, containsComponent: (child: ReactElement) => boolean, props: Partial<T>) => ReactNode; | ||
/** | ||
* Set two refs inside the ref property in order to allow the use of the local ref and an external one | ||
* @param refs Array with both refs | ||
* @returns ref property | ||
*/ | ||
declare const mergeRefs: <T = any>(refs: (react.MutableRefObject<T> | react.LegacyRef<T>)[]) => (instance: T | null) => void; | ||
@@ -40,2 +47,2 @@ declare type KeyVariants<KeyMap, Prop extends keyof CSSProperties> = { | ||
export { addPropsToChildren, booleanify, createConstants, isFragment, mapKeysToVariants }; | ||
export { addPropsToChildren, booleanify, createConstants, isFragment, mapKeysToVariants, mergeRefs }; |
{ | ||
"name": "@mirohq/design-system-utils", | ||
"version": "0.13.2", | ||
"version": "0.14.0-calendar-component.0", | ||
"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
17759
15.77%162
19.12%