kui-utils 0.0.17 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/index.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var _ = require('lodash');
7
- var reactRouter = require('react-router');
7
+ var reactRouterDom = require('react-router-dom');
8
8
  var mobx = require('mobx');
9
9
 
10
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -80,13 +80,13 @@ var useDebounce = function (value, delay, callback, deps) {
80
80
  };
81
81
 
82
82
  var useTabIndex = function (paths) {
83
- var searchParams = reactRouter.useLocation().search;
83
+ var searchParams = reactRouterDom.useLocation().search;
84
84
  return paths.findIndex(function (path) { return path.includes(searchParams); }) || null;
85
85
  };
86
86
 
87
87
  var useWindowWidth = function (time) {
88
88
  if (time === void 0) { time = 10; }
89
- var _a = React.useState(0), width = _a[0], setWidth = _a[1];
89
+ var _a = React.useState((window === null || window === void 0 ? void 0 : window.innerWidth) || 0), width = _a[0], setWidth = _a[1];
90
90
  React.useEffect(function () {
91
91
  setWidth(window.innerWidth);
92
92
  var handleResize = ___default["default"].debounce(function () {
@@ -266,9 +266,9 @@ var cropText = function (text, limit) {
266
266
  };
267
267
 
268
268
  var cases = [2, 0, 1, 1, 1, 2];
269
- var declineByNumber = function (num, titles) {
269
+ var declineByNumber = function (num, titles, withoutNumber) {
270
270
  return num
271
- ? "".concat(num, " ").concat(titles[num % 100 > 4 && num % 100 < 20
271
+ ? "".concat(withoutNumber ? "" : "".concat(num, " ")).concat(titles[num % 100 > 4 && num % 100 < 20
272
272
  ? 2
273
273
  : cases[num % 10 < 5 ? num % 10 : 5]])
274
274
  : "";