@commercetools-uikit/hooks 19.26.0 → 20.1.0

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.
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _Map = require('@babel/runtime-corejs3/core-js-stable/map');
6
6
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
7
7
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
8
+ var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
8
9
  var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
9
10
  var _spliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/splice');
10
11
  var react = require('react');
@@ -29,6 +30,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
29
30
  var _Map__default = /*#__PURE__*/_interopDefault(_Map);
30
31
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
31
32
  var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
33
+ var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
32
34
  var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
33
35
  var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
34
36
  var rafSchd__default = /*#__PURE__*/_interopDefault(rafSchd);
@@ -58,7 +60,7 @@ const useToggleState = defaultValue => {
58
60
  var useToggleState$1 = useToggleState;
59
61
 
60
62
  const usePrevious = value => {
61
- const ref = react.useRef();
63
+ const ref = react.useRef(null);
62
64
  react.useEffect(() => {
63
65
  ref.current = value;
64
66
  }, [value]);
@@ -102,8 +104,9 @@ function createMutationObserver() {
102
104
  return _mutationsByTarget;
103
105
  }, new _Map__default["default"]());
104
106
  _forEachInstanceProperty__default["default"](mutationsByTarget).call(mutationsByTarget, (mutations, target) => {
107
+ var _context, _context2;
105
108
  const targetCallbacks = callbacks.get(target);
106
- targetCallbacks?.forEach(cb => cb(mutations, observer));
109
+ ((_context = targetCallbacks) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _forEachInstanceProperty__default["default"](_context), _context))?.(cb => cb(mutations, observer));
107
110
  });
108
111
  }));
109
112
  return {
@@ -356,7 +359,7 @@ const useDataTableSortingState = function () {
356
359
  var useDataTableSortingState$1 = useDataTableSortingState;
357
360
 
358
361
  // NOTE: This string will be replaced on build time with the package version.
359
- var version = "19.26.0";
362
+ var version = "20.1.0";
360
363
 
361
364
  exports.useDataTableSortingState = useDataTableSortingState$1;
362
365
  exports.useFieldId = useFieldId$1;
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _Map = require('@babel/runtime-corejs3/core-js-stable/map');
6
6
  var _reduceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/reduce');
7
7
  var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/for-each');
8
+ var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/bind');
8
9
  var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/index-of');
9
10
  var _spliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/splice');
10
11
  var react = require('react');
@@ -29,6 +30,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
29
30
  var _Map__default = /*#__PURE__*/_interopDefault(_Map);
30
31
  var _reduceInstanceProperty__default = /*#__PURE__*/_interopDefault(_reduceInstanceProperty);
31
32
  var _forEachInstanceProperty__default = /*#__PURE__*/_interopDefault(_forEachInstanceProperty);
33
+ var _bindInstanceProperty__default = /*#__PURE__*/_interopDefault(_bindInstanceProperty);
32
34
  var _indexOfInstanceProperty__default = /*#__PURE__*/_interopDefault(_indexOfInstanceProperty);
33
35
  var _spliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_spliceInstanceProperty);
34
36
  var rafSchd__default = /*#__PURE__*/_interopDefault(rafSchd);
@@ -58,7 +60,7 @@ const useToggleState = defaultValue => {
58
60
  var useToggleState$1 = useToggleState;
59
61
 
60
62
  const usePrevious = value => {
61
- const ref = react.useRef();
63
+ const ref = react.useRef(null);
62
64
  react.useEffect(() => {
63
65
  ref.current = value;
64
66
  }, [value]);
@@ -102,8 +104,9 @@ function createMutationObserver() {
102
104
  return _mutationsByTarget;
103
105
  }, new _Map__default["default"]());
104
106
  _forEachInstanceProperty__default["default"](mutationsByTarget).call(mutationsByTarget, (mutations, target) => {
107
+ var _context, _context2;
105
108
  const targetCallbacks = callbacks.get(target);
106
- targetCallbacks?.forEach(cb => cb(mutations, observer));
109
+ ((_context = targetCallbacks) == null ? void 0 : _bindInstanceProperty__default["default"](_context2 = Function.call).call(_context2, _forEachInstanceProperty__default["default"](_context), _context))?.(cb => cb(mutations, observer));
107
110
  });
108
111
  }));
109
112
  return {
@@ -356,7 +359,7 @@ const useDataTableSortingState = function () {
356
359
  var useDataTableSortingState$1 = useDataTableSortingState;
357
360
 
358
361
  // NOTE: This string will be replaced on build time with the package version.
359
- var version = "19.26.0";
362
+ var version = "20.1.0";
360
363
 
361
364
  exports.useDataTableSortingState = useDataTableSortingState$1;
362
365
  exports.useFieldId = useFieldId$1;
@@ -1,6 +1,7 @@
1
1
  import _Map from '@babel/runtime-corejs3/core-js-stable/map';
2
2
  import _reduceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/reduce';
3
3
  import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/for-each';
4
+ import _bindInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/bind';
4
5
  import _indexOfInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/index-of';
5
6
  import _spliceInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/splice';
6
7
  import { useState, useCallback, useRef, useEffect, useLayoutEffect, useReducer, useDebugValue } from 'react';
@@ -34,7 +35,7 @@ const useToggleState = defaultValue => {
34
35
  var useToggleState$1 = useToggleState;
35
36
 
36
37
  const usePrevious = value => {
37
- const ref = useRef();
38
+ const ref = useRef(null);
38
39
  useEffect(() => {
39
40
  ref.current = value;
40
41
  }, [value]);
@@ -78,8 +79,9 @@ function createMutationObserver() {
78
79
  return _mutationsByTarget;
79
80
  }, new _Map());
80
81
  _forEachInstanceProperty(mutationsByTarget).call(mutationsByTarget, (mutations, target) => {
82
+ var _context, _context2;
81
83
  const targetCallbacks = callbacks.get(target);
82
- targetCallbacks?.forEach(cb => cb(mutations, observer));
84
+ ((_context = targetCallbacks) == null ? void 0 : _bindInstanceProperty(_context2 = Function.call).call(_context2, _forEachInstanceProperty(_context), _context))?.(cb => cb(mutations, observer));
83
85
  });
84
86
  }));
85
87
  return {
@@ -332,6 +334,6 @@ const useDataTableSortingState = function () {
332
334
  var useDataTableSortingState$1 = useDataTableSortingState;
333
335
 
334
336
  // NOTE: This string will be replaced on build time with the package version.
335
- var version = "19.26.0";
337
+ var version = "20.1.0";
336
338
 
337
339
  export { useDataTableSortingState$1 as useDataTableSortingState, useFieldId$1 as useFieldId, useMutationObserver, usePaginationState$1 as usePaginationState, usePrevious$1 as usePrevious, useRowSelection$1 as useRowSelection, useSorting$1 as useSorting, useToggleState$1 as useToggleState, version };
@@ -1,2 +1,2 @@
1
- declare const usePrevious: <Ref>(value: Ref) => Ref | undefined;
1
+ declare const usePrevious: <Ref>(value: Ref) => Ref | null;
2
2
  export default usePrevious;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commercetools-uikit/hooks",
3
3
  "description": "A collection of React hooks used across some of the UI-Kit components.",
4
- "version": "19.26.0",
4
+ "version": "20.1.0",
5
5
  "bugs": "https://github.com/commercetools/ui-kit/issues",
6
6
  "repository": {
7
7
  "type": "git",
@@ -24,18 +24,19 @@
24
24
  "dependencies": {
25
25
  "@babel/runtime": "^7.20.13",
26
26
  "@babel/runtime-corejs3": "^7.20.13",
27
- "@commercetools-uikit/utils": "19.26.0",
27
+ "@commercetools-uikit/utils": "20.1.0",
28
28
  "@types/raf-schd": "^4.0.1",
29
29
  "lodash": "4.17.21",
30
30
  "raf-schd": "^4.0.3"
31
31
  },
32
32
  "devDependencies": {
33
- "@testing-library/react": "12.1.5",
34
- "react": "17.0.2",
35
- "react-dom": "17.0.2"
33
+ "@testing-library/dom": "^10.4.0",
34
+ "@testing-library/react": "^16.2.0",
35
+ "react": "19.1.0",
36
+ "react-dom": "19.1.0"
36
37
  },
37
38
  "peerDependencies": {
38
- "react": "17.x",
39
- "react-dom": "17.x"
39
+ "react": "19.x",
40
+ "react-dom": "19.x"
40
41
  }
41
42
  }