@micromag/core 0.3.757 → 0.3.767

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.
Files changed (3) hide show
  1. package/es/hooks.js +9 -2
  2. package/es/index.js +18 -11
  3. package/package.json +3 -3
package/es/hooks.js CHANGED
@@ -4,7 +4,7 @@ import { EventsManager, MediasParser, StoryParser, ThemeParser } from '@micromag
4
4
  import { createUseEvent, getMediaFilesAsArray } from '@micromag/core/utils';
5
5
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
6
6
  import { useSpring, useSprings } from '@react-spring/core';
7
- import { useDrag } from '@use-gesture/react';
7
+ import { useGesture, useDrag } from '@use-gesture/react';
8
8
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
9
9
  import { useForm as useForm$1 } from '@folklore/forms';
10
10
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
@@ -201,6 +201,8 @@ function useDragProgress() {
201
201
  computeProgress = _ref$computeProgress === void 0 ? null : _ref$computeProgress,
202
202
  _ref$onProgress = _ref.onProgress,
203
203
  onProgress = _ref$onProgress === void 0 ? null : _ref$onProgress,
204
+ _ref$onPointerDown = _ref.onPointerDown,
205
+ onPointerDown = _ref$onPointerDown === void 0 ? null : _ref$onPointerDown,
204
206
  _ref$springParams = _ref.springParams,
205
207
  springParams = _ref$springParams === void 0 ? undefined : _ref$springParams,
206
208
  _ref$dragOptions = _ref.dragOptions,
@@ -268,7 +270,12 @@ function useDragProgress() {
268
270
  onProgress(newProgress, gestureState);
269
271
  }
270
272
  }, [setDragging, disabled, onTap, computeProgress, dragging, onProgress]);
271
- var bind = useDrag(onDrag, dragOptions);
273
+ var bind = useGesture({
274
+ onDrag: onDrag,
275
+ onPointerDown: onPointerDown
276
+ }, {
277
+ drag: dragOptions
278
+ });
272
279
  useEffect(function () {
273
280
  if (!refDragging.current && wantedProgress !== refProgress.current) {
274
281
  setDirection(wantedProgress < refProgress.current ? -1 : 1);
package/es/index.js CHANGED
@@ -17,7 +17,6 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
17
17
  import isString from 'lodash/isString';
18
18
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
19
19
  import uniq from 'lodash/uniq';
20
- import { isString as isString$1 } from 'lodash';
21
20
  import isEmpty from 'lodash/isEmpty';
22
21
  import { Tracking as Tracking$1 } from '@folklore/tracking';
23
22
  import PropTypes$1 from 'prop-types';
@@ -1786,7 +1785,7 @@ var KeypadItemLabel = /*#__PURE__*/function () {
1786
1785
  }
1787
1786
  var hasStringItemLabel = (items || []).some(function () {
1788
1787
  var item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1789
- return item !== null && isString$1(item === null || item === void 0 ? void 0 : item.label);
1788
+ return item !== null && isString(item === null || item === void 0 ? void 0 : item.label);
1790
1789
  });
1791
1790
  if (!hasStringItemLabel) {
1792
1791
  return false;
@@ -1803,7 +1802,7 @@ var KeypadItemLabel = /*#__PURE__*/function () {
1803
1802
  return _objectSpread(_objectSpread({}, restScreen), {}, {
1804
1803
  items: items.map(function () {
1805
1804
  var item = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1806
- if (item === null || !isString$1(item === null || item === void 0 ? void 0 : item.label)) {
1805
+ if (item === null || !isString(item === null || item === void 0 ? void 0 : item.label)) {
1807
1806
  return item;
1808
1807
  }
1809
1808
  var _ref3 = item || {},
@@ -2350,12 +2349,16 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2350
2349
  }
2351
2350
  }, {
2352
2351
  key: "trackEvent",
2353
- value: function trackEvent(category, action, label) {
2354
- var _ref4 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
2352
+ value: function trackEvent() {
2353
+ var category = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2354
+ var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2355
+ var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2356
+ var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
2357
+ var _ref4 = opts || {},
2355
2358
  _ref4$value = _ref4.value,
2356
2359
  value = _ref4$value === void 0 ? null : _ref4$value,
2357
- opts = _objectWithoutProperties(_ref4, _excluded);
2358
- var data = _objectSpread(_objectSpread({}, opts), {}, {
2360
+ otherOpts = _objectWithoutProperties(_ref4, _excluded);
2361
+ var data = _objectSpread(_objectSpread({}, otherOpts || null), {}, {
2359
2362
  event: 'eventInteraction',
2360
2363
  eventCategory: category,
2361
2364
  eventAction: action,
@@ -2366,13 +2369,17 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2366
2369
  }
2367
2370
  }, {
2368
2371
  key: "trackMedia",
2369
- value: function trackMedia(type, media, action) {
2370
- var _ref5 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
2372
+ value: function trackMedia() {
2373
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2374
+ var media = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2375
+ var action = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
2376
+ var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
2377
+ var _ref5 = opts || {},
2371
2378
  _ref5$value = _ref5.value,
2372
2379
  value = _ref5$value === void 0 ? null : _ref5$value,
2373
2380
  _ref5$currentTime = _ref5.currentTime,
2374
2381
  optsCurrentTime = _ref5$currentTime === void 0 ? null : _ref5$currentTime,
2375
- opts = _objectWithoutProperties(_ref5, _excluded2);
2382
+ otherOpts = _objectWithoutProperties(_ref5, _excluded2);
2376
2383
  var _ref6 = media || {},
2377
2384
  _ref6$id = _ref6.id,
2378
2385
  mediaId = _ref6$id === void 0 ? null : _ref6$id,
@@ -2389,7 +2396,7 @@ var Tracking = /*#__PURE__*/function (_BaseTracking) {
2389
2396
  var _ref7 = metadata || {},
2390
2397
  _ref7$duration = _ref7.duration,
2391
2398
  duration = _ref7$duration === void 0 ? rootDuration : _ref7$duration;
2392
- var data = _objectSpread(_objectSpread({}, opts), {}, {
2399
+ var data = _objectSpread(_objectSpread({}, otherOpts || null), {}, {
2393
2400
  event: 'eventInteraction',
2394
2401
  eventCategory: type,
2395
2402
  eventAction: action,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/core",
3
- "version": "0.3.757",
3
+ "version": "0.3.767",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -125,7 +125,7 @@
125
125
  "@folklore/routes": "^0.2.36",
126
126
  "@folklore/services": "^0.1.24",
127
127
  "@folklore/size": "^0.1.20",
128
- "@folklore/tracking": "~0.0.28",
128
+ "@folklore/tracking": "^0.0.34",
129
129
  "@fortawesome/fontawesome-svg-core": "^6.5.2",
130
130
  "@fortawesome/free-solid-svg-icons": "^6.5.2",
131
131
  "@fortawesome/react-fontawesome": "^0.2.0",
@@ -159,5 +159,5 @@
159
159
  "access": "public",
160
160
  "registry": "https://registry.npmjs.org/"
161
161
  },
162
- "gitHead": "9f1f9aa6e7a767417e33e420bc6c0e1581d40087"
162
+ "gitHead": "af57b08ccc073db83b6480e3a43fe14e6f36e0f6"
163
163
  }