@che-ins-ui/utils
Advanced tools
Comparing version 3.0.68 to 3.0.69
export * from "./mergeRefs"; | ||
export * from "./toggleElementInArray"; | ||
export * from "./useClickOutsideComponents"; | ||
export * from "./getStaticImageProps"; | ||
export * from "./useKeyboardEvent"; | ||
export * from "./addUuidToObject"; | ||
export * from "./isBrowser"; |
@@ -75,2 +75,27 @@ 'use strict'; | ||
var ICONS_STATIC_PATH = "/files/common/icons/"; | ||
var KIRK_ORIGIN = "https://kirk.cherehapa.ru"; | ||
var getStaticImageProps = function getStaticImageProps(_ref) { | ||
var name = _ref.name, | ||
_ref$path = _ref.path, | ||
path = _ref$path === void 0 ? ICONS_STATIC_PATH : _ref$path, | ||
_ref$ext = _ref.ext, | ||
ext = _ref$ext === void 0 ? ".png" : _ref$ext, | ||
_ref$width = _ref.width, | ||
width = _ref$width === void 0 ? 15 : _ref$width, | ||
_ref$height = _ref.height, | ||
height = _ref$height === void 0 ? 15 : _ref$height, | ||
alt = _ref.alt, | ||
origin = _ref.origin; | ||
var mainOrigin = origin || (location.origin.includes("localhost") ? KIRK_ORIGIN : null) || location.origin; | ||
var src = mainOrigin + path + name + ext; | ||
var imageProps = { | ||
src: src, | ||
width: width, | ||
height: height, | ||
alt: alt || name | ||
}; | ||
return imageProps; | ||
}; | ||
/** | ||
@@ -137,2 +162,3 @@ * | ||
exports.addUuidToObject = addUuidToObject; | ||
exports.getStaticImageProps = getStaticImageProps; | ||
exports.isBrowser = isBrowser; | ||
@@ -139,0 +165,0 @@ exports.toggleElementInArray = toggleElementInArray; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("uuid");function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}exports.addUuidToObject=function(e){return o({},e,{_uuid:r.v4()})},exports.isBrowser=function(){return"undefined"!=typeof window},exports.toggleElementInArray=function(e,t){return e.some((function(e){return e===t}))?e.filter((function(e){return e!==t})):[].concat(e,[t])},exports.useClickOutsideComponents=function(e,n){t.useEffect((function(){var t=function(t){e.every((function(e){return e.current&&!e.current.contains(t.target)}))&&n(t)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),function(){document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[n])},exports.useCombinedRefs=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=n.useRef(null);return n.useEffect((function(){t.forEach((function(e){e&&o.current&&(e.current=o.current)}))}),[t]),o},exports.useKeyboardEvent=function(e,n,r){void 0===r&&(r="keyup"),t.useEffect((function(){var t=function(t){t instanceof KeyboardEvent&&t.key===n&&(t.stopPropagation(),e())};return document.addEventListener(r,t),function(){document.removeEventListener(r,t)}}),[e,n,r])}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=require("uuid");function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}exports.addUuidToObject=function(e){return o({},e,{_uuid:r.v4()})},exports.getStaticImageProps=function(e){var t=e.name,n=e.path,r=void 0===n?"/files/common/icons/":n,o=e.ext,u=void 0===o?".png":o,i=e.width,c=void 0===i?15:i,s=e.height,a=void 0===s?15:s,f=e.alt;return{src:(e.origin||(location.origin.includes("localhost")?"https://kirk.cherehapa.ru":null)||location.origin)+r+t+u,width:c,height:a,alt:f||t}},exports.isBrowser=function(){return"undefined"!=typeof window},exports.toggleElementInArray=function(e,t){return e.some((function(e){return e===t}))?e.filter((function(e){return e!==t})):[].concat(e,[t])},exports.useClickOutsideComponents=function(e,n){t.useEffect((function(){var t=function(t){e.every((function(e){return e.current&&!e.current.contains(t.target)}))&&n(t)};return document.addEventListener("mousedown",t),document.addEventListener("touchstart",t),function(){document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t)}}),[n])},exports.useCombinedRefs=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o=n.useRef(null);return n.useEffect((function(){t.forEach((function(e){e&&o.current&&(e.current=o.current)}))}),[t]),o},exports.useKeyboardEvent=function(e,n,r){void 0===r&&(r="keyup"),t.useEffect((function(){var t=function(t){t instanceof KeyboardEvent&&t.key===n&&(t.stopPropagation(),e())};return document.addEventListener(r,t),function(){document.removeEventListener(r,t)}}),[e,n,r])}; | ||
//# sourceMappingURL=utils.cjs.production.min.js.map |
@@ -68,2 +68,27 @@ import React, { useEffect } from 'react'; | ||
var ICONS_STATIC_PATH = "/files/common/icons/"; | ||
var KIRK_ORIGIN = "https://kirk.cherehapa.ru"; | ||
var getStaticImageProps = function getStaticImageProps(_ref) { | ||
var name = _ref.name, | ||
_ref$path = _ref.path, | ||
path = _ref$path === void 0 ? ICONS_STATIC_PATH : _ref$path, | ||
_ref$ext = _ref.ext, | ||
ext = _ref$ext === void 0 ? ".png" : _ref$ext, | ||
_ref$width = _ref.width, | ||
width = _ref$width === void 0 ? 15 : _ref$width, | ||
_ref$height = _ref.height, | ||
height = _ref$height === void 0 ? 15 : _ref$height, | ||
alt = _ref.alt, | ||
origin = _ref.origin; | ||
var mainOrigin = origin || (location.origin.includes("localhost") ? KIRK_ORIGIN : null) || location.origin; | ||
var src = mainOrigin + path + name + ext; | ||
var imageProps = { | ||
src: src, | ||
width: width, | ||
height: height, | ||
alt: alt || name | ||
}; | ||
return imageProps; | ||
}; | ||
/** | ||
@@ -129,3 +154,3 @@ * | ||
export { addUuidToObject, isBrowser, toggleElementInArray, useClickOutsideComponents, useCombinedRefs, useKeyboardEvent }; | ||
export { addUuidToObject, getStaticImageProps, isBrowser, toggleElementInArray, useClickOutsideComponents, useCombinedRefs, useKeyboardEvent }; | ||
//# sourceMappingURL=utils.esm.js.map |
{ | ||
"name": "@che-ins-ui/utils", | ||
"version": "3.0.68", | ||
"version": "3.0.69", | ||
"description": "<>", | ||
@@ -24,3 +24,3 @@ "build:storybook": "src/index.ts", | ||
"dependencies": { | ||
"@che-ins-ui/theme": "^3.1.44" | ||
"@che-ins-ui/theme": "^3.1.45" | ||
}, | ||
@@ -34,3 +34,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "b9ffee264fb91af226b9653732e5f55f00bf2033" | ||
"gitHead": "f036046b05da4f201dcf03da9522c839267ff3cc" | ||
} |
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
38364
18
356
Updated@che-ins-ui/theme@^3.1.45