@bone-ui/utils
Advanced tools
Comparing version 0.28.0 to 0.28.1
@@ -10,1 +10,2 @@ import React from 'react'; | ||
export declare function getValidChildren(children: React.ReactNode): any[]; | ||
export declare function mergeRefs<T = any>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>): React.RefCallback<T>; |
@@ -57,2 +57,13 @@ 'use strict'; | ||
} | ||
function mergeRefs(refs) { | ||
return function (value) { | ||
refs.forEach(function (ref) { | ||
if (typeof ref === 'function') { | ||
ref(value); | ||
} else if (ref != null) { | ||
ref.current = value; | ||
} | ||
}); | ||
}; | ||
} | ||
@@ -69,2 +80,3 @@ exports.__DEV__ = __DEV__; | ||
exports.last = last; | ||
exports.mergeRefs = mergeRefs; | ||
//# sourceMappingURL=utils.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r,t=(r=require("react"))&&"object"==typeof r&&"default"in r?r.default:r;exports.__DEV__=!1,exports.chunk=function(r,t){return r.reduce((function(r,e,n){return n%t==0?r.push([e]):r[r.length-1].push(e),r}),[])},exports.cx=function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return t.filter(Boolean).join(" ")},exports.first=function(r){return null!=r&&r.length?r[0]:void 0},exports.forwardRef=function(r){return t.forwardRef(r)},exports.fromEntries=function(r){return r.reduce((function(r,t){return r[t[0]]=t[1],r}),{})},exports.getValidChildren=function(r){return(Array.isArray(r)?r:[r]).filter((function(r){return t.isValidElement(r)}))},exports.guid=function(){return String.fromCharCode(Math.floor(26*Math.random())+97)+Math.random().toString(16).slice(2)+Date.now().toString(16).slice(4)},exports.isReactText=function(r){return["string","number"].includes(typeof r)},exports.last=function(r){var t=null==r?0:r.length;return t?r[t-1]:void 0}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r,t=(r=require("react"))&&"object"==typeof r&&"default"in r?r.default:r;exports.__DEV__=!1,exports.chunk=function(r,t){return r.reduce((function(r,e,n){return n%t==0?r.push([e]):r[r.length-1].push(e),r}),[])},exports.cx=function(){for(var r=arguments.length,t=new Array(r),e=0;e<r;e++)t[e]=arguments[e];return t.filter(Boolean).join(" ")},exports.first=function(r){return null!=r&&r.length?r[0]:void 0},exports.forwardRef=function(r){return t.forwardRef(r)},exports.fromEntries=function(r){return r.reduce((function(r,t){return r[t[0]]=t[1],r}),{})},exports.getValidChildren=function(r){return(Array.isArray(r)?r:[r]).filter((function(r){return t.isValidElement(r)}))},exports.guid=function(){return String.fromCharCode(Math.floor(26*Math.random())+97)+Math.random().toString(16).slice(2)+Date.now().toString(16).slice(4)},exports.isReactText=function(r){return["string","number"].includes(typeof r)},exports.last=function(r){var t=null==r?0:r.length;return t?r[t-1]:void 0},exports.mergeRefs=function(r){return function(t){r.forEach((function(r){"function"==typeof r?r(t):null!=r&&(r.current=t)}))}}; | ||
//# sourceMappingURL=utils.cjs.production.min.js.map |
@@ -51,4 +51,15 @@ import React from 'react'; | ||
} | ||
function mergeRefs(refs) { | ||
return function (value) { | ||
refs.forEach(function (ref) { | ||
if (typeof ref === 'function') { | ||
ref(value); | ||
} else if (ref != null) { | ||
ref.current = value; | ||
} | ||
}); | ||
}; | ||
} | ||
export { __DEV__, chunk, cx, first, forwardRef, fromEntries, getValidChildren, guid, isReactText, last }; | ||
export { __DEV__, chunk, cx, first, forwardRef, fromEntries, getValidChildren, guid, isReactText, last, mergeRefs }; | ||
//# sourceMappingURL=utils.esm.js.map |
{ | ||
"name": "@bone-ui/utils", | ||
"version": "0.28.0", | ||
"version": "0.28.1", | ||
"main": "dist/index.js", | ||
@@ -15,2 +15,3 @@ "module": "dist/utils.esm.js", | ||
"devDependencies": { | ||
"@types/react": "^18.0.15", | ||
"tsdx": "^0.14.1", | ||
@@ -20,3 +21,3 @@ "tslib": "^2.4.1", | ||
}, | ||
"gitHead": "0c05c4c64b8e6f5a9a83d75d4cd1b9fcf7708640" | ||
"gitHead": "08f29bc96cb4a81777a1647ecc64141acd019fb2" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
23506
237
4