@atlaskit/blanket 12.3.5 → 12.3.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/blanket
2
2
 
3
+ ## 12.3.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a7e8a6c3ace`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a7e8a6c3ace) - Prevent onBlanketClick function firing on Blanket when mousedown event begins on Blanket children
8
+
3
9
  ## 12.3.5
4
10
 
5
11
  ### Patch Changes
@@ -16,7 +16,7 @@ var _constants = require("@atlaskit/theme/constants");
16
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
18
  var packageName = "@atlaskit/blanket";
19
- var packageVersion = "12.3.5";
19
+ var packageVersion = "12.3.6";
20
20
  var analyticsAttributes = {
21
21
  componentName: 'blanket',
22
22
  packageName: packageName,
@@ -68,19 +68,24 @@ var Blanket = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)
68
68
  analyticsContext = _ref.analyticsContext;
69
69
  var _useGlobalTheme = (0, _components.useGlobalTheme)(),
70
70
  mode = _useGlobalTheme.mode;
71
+ var mouseDownTarget = (0, _react.useRef)(null);
71
72
  var onBlanketClickedWithAnalytics = (0, _usePlatformLeafEventHandler.usePlatformLeafEventHandler)(_objectSpread({
72
73
  fn: onBlanketClicked,
73
74
  action: 'clicked',
74
75
  analyticsData: analyticsContext
75
76
  }, analyticsAttributes));
76
77
  var blanketClickOutsideChildren = (0, _react.useCallback)(function (e) {
77
- return e.currentTarget === e.target ? onBlanketClickedWithAnalytics(e) : undefined;
78
+ return e.currentTarget === e.target && mouseDownTarget.current === e.target ? onBlanketClickedWithAnalytics(e) : undefined;
78
79
  }, [onBlanketClickedWithAnalytics]);
79
80
  var onClick = shouldAllowClickThrough ? undefined : blanketClickOutsideChildren;
81
+ var onMouseDown = (0, _react.useCallback)(function (e) {
82
+ mouseDownTarget.current = e.target;
83
+ }, []);
80
84
  return (0, _react2.jsx)("div", {
81
85
  role: "presentation",
82
86
  css: [baseStyles, shouldAllowClickThrough && shouldAllowClickThroughStyles, backgroundStyle[mode], !isTinted && invisibleStyles],
83
87
  onClick: onClick,
88
+ onMouseDown: onMouseDown,
84
89
  "data-testid": testId,
85
90
  ref: ref
86
91
  }, children);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/blanket",
3
- "version": "12.3.5",
3
+ "version": "12.3.6",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { forwardRef, memo, useCallback } from 'react';
2
+ import { forwardRef, memo, useCallback, useRef } from 'react';
3
3
  import { css, jsx } from '@emotion/react';
4
4
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
5
5
  import noop from '@atlaskit/ds-lib/noop';
@@ -7,7 +7,7 @@ import { DN90A, N100A } from '@atlaskit/theme/colors';
7
7
  import { useGlobalTheme } from '@atlaskit/theme/components';
8
8
  import { layers } from '@atlaskit/theme/constants';
9
9
  const packageName = "@atlaskit/blanket";
10
- const packageVersion = "12.3.5";
10
+ const packageVersion = "12.3.6";
11
11
  const analyticsAttributes = {
12
12
  componentName: 'blanket',
13
13
  packageName,
@@ -58,18 +58,23 @@ const Blanket = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Blanket({
58
58
  const {
59
59
  mode
60
60
  } = useGlobalTheme();
61
+ const mouseDownTarget = useRef(null);
61
62
  const onBlanketClickedWithAnalytics = usePlatformLeafEventHandler({
62
63
  fn: onBlanketClicked,
63
64
  action: 'clicked',
64
65
  analyticsData: analyticsContext,
65
66
  ...analyticsAttributes
66
67
  });
67
- const blanketClickOutsideChildren = useCallback(e => e.currentTarget === e.target ? onBlanketClickedWithAnalytics(e) : undefined, [onBlanketClickedWithAnalytics]);
68
+ const blanketClickOutsideChildren = useCallback(e => e.currentTarget === e.target && mouseDownTarget.current === e.target ? onBlanketClickedWithAnalytics(e) : undefined, [onBlanketClickedWithAnalytics]);
68
69
  const onClick = shouldAllowClickThrough ? undefined : blanketClickOutsideChildren;
70
+ const onMouseDown = useCallback(e => {
71
+ mouseDownTarget.current = e.target;
72
+ }, []);
69
73
  return jsx("div", {
70
74
  role: "presentation",
71
75
  css: [baseStyles, shouldAllowClickThrough && shouldAllowClickThroughStyles, backgroundStyle[mode], !isTinted && invisibleStyles],
72
76
  onClick: onClick,
77
+ onMouseDown: onMouseDown,
73
78
  "data-testid": testId,
74
79
  ref: ref
75
80
  }, children);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/blanket",
3
- "version": "12.3.5",
3
+ "version": "12.3.6",
4
4
  "sideEffects": false
5
5
  }
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
4
  /** @jsx jsx */
5
- import { forwardRef, memo, useCallback } from 'react';
5
+ import { forwardRef, memo, useCallback, useRef } from 'react';
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
8
8
  import noop from '@atlaskit/ds-lib/noop';
@@ -10,7 +10,7 @@ import { DN90A, N100A } from '@atlaskit/theme/colors';
10
10
  import { useGlobalTheme } from '@atlaskit/theme/components';
11
11
  import { layers } from '@atlaskit/theme/constants';
12
12
  var packageName = "@atlaskit/blanket";
13
- var packageVersion = "12.3.5";
13
+ var packageVersion = "12.3.6";
14
14
  var analyticsAttributes = {
15
15
  componentName: 'blanket',
16
16
  packageName: packageName,
@@ -62,19 +62,24 @@ var Blanket = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Blanket(_ref,
62
62
  analyticsContext = _ref.analyticsContext;
63
63
  var _useGlobalTheme = useGlobalTheme(),
64
64
  mode = _useGlobalTheme.mode;
65
+ var mouseDownTarget = useRef(null);
65
66
  var onBlanketClickedWithAnalytics = usePlatformLeafEventHandler(_objectSpread({
66
67
  fn: onBlanketClicked,
67
68
  action: 'clicked',
68
69
  analyticsData: analyticsContext
69
70
  }, analyticsAttributes));
70
71
  var blanketClickOutsideChildren = useCallback(function (e) {
71
- return e.currentTarget === e.target ? onBlanketClickedWithAnalytics(e) : undefined;
72
+ return e.currentTarget === e.target && mouseDownTarget.current === e.target ? onBlanketClickedWithAnalytics(e) : undefined;
72
73
  }, [onBlanketClickedWithAnalytics]);
73
74
  var onClick = shouldAllowClickThrough ? undefined : blanketClickOutsideChildren;
75
+ var onMouseDown = useCallback(function (e) {
76
+ mouseDownTarget.current = e.target;
77
+ }, []);
74
78
  return jsx("div", {
75
79
  role: "presentation",
76
80
  css: [baseStyles, shouldAllowClickThrough && shouldAllowClickThroughStyles, backgroundStyle[mode], !isTinted && invisibleStyles],
77
81
  onClick: onClick,
82
+ onMouseDown: onMouseDown,
78
83
  "data-testid": testId,
79
84
  ref: ref
80
85
  }, children);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/blanket",
3
- "version": "12.3.5",
3
+ "version": "12.3.6",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/blanket",
3
- "version": "12.3.5",
3
+ "version": "12.3.6",
4
4
  "description": "A blanket covers the underlying UI for a layered component, such as a modal dialog or a tooltip.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -33,7 +33,7 @@
33
33
  "@atlaskit/codemod-utils": "^4.1.0",
34
34
  "@atlaskit/ds-lib": "^2.1.0",
35
35
  "@atlaskit/theme": "^12.2.0",
36
- "@atlaskit/tokens": "^1.0.0",
36
+ "@atlaskit/tokens": "^1.1.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "@emotion/react": "^11.7.1"
39
39
  },
@@ -51,6 +51,7 @@
51
51
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
52
52
  "@testing-library/dom": "^8.17.1",
53
53
  "@testing-library/react": "^12.1.5",
54
+ "@testing-library/user-event": "^14.4.3",
54
55
  "jscodeshift": "^0.13.0",
55
56
  "react-dom": "^16.8.0",
56
57
  "react-lorem-component": "^0.13.0",
@@ -76,8 +77,10 @@
76
77
  ],
77
78
  "ui-components": "lite-mode",
78
79
  "analytics": "analytics-next",
79
- "design-tokens": "spacing",
80
- "theming": "tokens",
80
+ "design-tokens": [
81
+ "color",
82
+ "spacing"
83
+ ],
81
84
  "deprecation": "no-deprecated-imports"
82
85
  }
83
86
  },