@atlaskit/react-ufo 2.0.6 → 2.0.7

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,13 @@
1
1
  # @atlaskit/ufo-interaction-ignore
2
2
 
3
+ ## 2.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#155785](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155785)
8
+ [`0c6d7f8285d34`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0c6d7f8285d34) -
9
+ moved atlaskit ufo-interaction-ignore to atlaskit/react-ufo
10
+
3
11
  ## 2.0.6
4
12
 
5
13
  ### Patch Changes
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ Object.defineProperty(exports, "default", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _ufoInteractionIgnore.default;
11
+ }
12
+ });
13
+ var _ufoInteractionIgnore = _interopRequireDefault(require("./ufo-interaction-ignore"));
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = UFOInteractionIgnore;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _interactionContext = _interopRequireDefault(require("@atlaskit/interaction-context"));
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
+ /**
17
+ * Prevent a subtree from holding up an interaction
18
+ * Use this when you have a component which loads in late, but
19
+ * isn't considered to be a breach of SLO
20
+ *
21
+ * ```js
22
+ * <App>
23
+ * <Main />
24
+ * <Sidebar>
25
+ * <UFOInteractionIgnore>
26
+ * <InsightsButton />
27
+ * </UFOInteractionIgnore>
28
+ * </Sidebar>
29
+ * </App>
30
+ * ```
31
+ *
32
+ * Has an `ignore` prop, to allow you to use it conditionally
33
+ */
34
+ function UFOInteractionIgnore(_ref) {
35
+ var children = _ref.children,
36
+ _ref$ignore = _ref.ignore,
37
+ ignore = _ref$ignore === void 0 ? true : _ref$ignore;
38
+ var parentContext = (0, _react.useContext)(_interactionContext.default);
39
+ var ignoredInteractionContext = (0, _react.useMemo)(function () {
40
+ if (!parentContext) {
41
+ return null;
42
+ }
43
+ return _objectSpread(_objectSpread({}, parentContext), {}, {
44
+ hold: function hold() {
45
+ if (!ignore) {
46
+ return parentContext.hold.apply(parentContext, arguments);
47
+ }
48
+ }
49
+ });
50
+ }, [parentContext, ignore]);
51
+
52
+ // react-18: Use children directly
53
+ var kids = children != null ? children : null;
54
+ if (!ignoredInteractionContext) {
55
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, kids);
56
+ }
57
+ return /*#__PURE__*/_react.default.createElement(_interactionContext.default.Provider, {
58
+ value: ignoredInteractionContext
59
+ }, kids);
60
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ufo-interaction-ignore';
@@ -0,0 +1,49 @@
1
+ import React, { useContext, useMemo } from 'react';
2
+ import InteractionContext from '@atlaskit/interaction-context';
3
+
4
+ /**
5
+ * Prevent a subtree from holding up an interaction
6
+ * Use this when you have a component which loads in late, but
7
+ * isn't considered to be a breach of SLO
8
+ *
9
+ * ```js
10
+ * <App>
11
+ * <Main />
12
+ * <Sidebar>
13
+ * <UFOInteractionIgnore>
14
+ * <InsightsButton />
15
+ * </UFOInteractionIgnore>
16
+ * </Sidebar>
17
+ * </App>
18
+ * ```
19
+ *
20
+ * Has an `ignore` prop, to allow you to use it conditionally
21
+ */
22
+ export default function UFOInteractionIgnore({
23
+ children,
24
+ ignore = true
25
+ }) {
26
+ const parentContext = useContext(InteractionContext);
27
+ const ignoredInteractionContext = useMemo(() => {
28
+ if (!parentContext) {
29
+ return null;
30
+ }
31
+ return {
32
+ ...parentContext,
33
+ hold(...args) {
34
+ if (!ignore) {
35
+ return parentContext.hold(...args);
36
+ }
37
+ }
38
+ };
39
+ }, [parentContext, ignore]);
40
+
41
+ // react-18: Use children directly
42
+ const kids = children != null ? children : null;
43
+ if (!ignoredInteractionContext) {
44
+ return /*#__PURE__*/React.createElement(React.Fragment, null, kids);
45
+ }
46
+ return /*#__PURE__*/React.createElement(InteractionContext.Provider, {
47
+ value: ignoredInteractionContext
48
+ }, kids);
49
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ufo-interaction-ignore';
@@ -0,0 +1,51 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ import React, { useContext, useMemo } from 'react';
5
+ import InteractionContext from '@atlaskit/interaction-context';
6
+
7
+ /**
8
+ * Prevent a subtree from holding up an interaction
9
+ * Use this when you have a component which loads in late, but
10
+ * isn't considered to be a breach of SLO
11
+ *
12
+ * ```js
13
+ * <App>
14
+ * <Main />
15
+ * <Sidebar>
16
+ * <UFOInteractionIgnore>
17
+ * <InsightsButton />
18
+ * </UFOInteractionIgnore>
19
+ * </Sidebar>
20
+ * </App>
21
+ * ```
22
+ *
23
+ * Has an `ignore` prop, to allow you to use it conditionally
24
+ */
25
+ export default function UFOInteractionIgnore(_ref) {
26
+ var children = _ref.children,
27
+ _ref$ignore = _ref.ignore,
28
+ ignore = _ref$ignore === void 0 ? true : _ref$ignore;
29
+ var parentContext = useContext(InteractionContext);
30
+ var ignoredInteractionContext = useMemo(function () {
31
+ if (!parentContext) {
32
+ return null;
33
+ }
34
+ return _objectSpread(_objectSpread({}, parentContext), {}, {
35
+ hold: function hold() {
36
+ if (!ignore) {
37
+ return parentContext.hold.apply(parentContext, arguments);
38
+ }
39
+ }
40
+ });
41
+ }, [parentContext, ignore]);
42
+
43
+ // react-18: Use children directly
44
+ var kids = children != null ? children : null;
45
+ if (!ignoredInteractionContext) {
46
+ return /*#__PURE__*/React.createElement(React.Fragment, null, kids);
47
+ }
48
+ return /*#__PURE__*/React.createElement(InteractionContext.Provider, {
49
+ value: ignoredInteractionContext
50
+ }, kids);
51
+ }
@@ -0,0 +1 @@
1
+ export { default } from './ufo-interaction-ignore';
@@ -0,0 +1,23 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * Prevent a subtree from holding up an interaction
4
+ * Use this when you have a component which loads in late, but
5
+ * isn't considered to be a breach of SLO
6
+ *
7
+ * ```js
8
+ * <App>
9
+ * <Main />
10
+ * <Sidebar>
11
+ * <UFOInteractionIgnore>
12
+ * <InsightsButton />
13
+ * </UFOInteractionIgnore>
14
+ * </Sidebar>
15
+ * </App>
16
+ * ```
17
+ *
18
+ * Has an `ignore` prop, to allow you to use it conditionally
19
+ */
20
+ export default function UFOInteractionIgnore({ children, ignore, }: {
21
+ children?: ReactNode;
22
+ ignore?: boolean;
23
+ }): JSX.Element;
@@ -0,0 +1 @@
1
+ export { default } from './ufo-interaction-ignore';
@@ -0,0 +1,23 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * Prevent a subtree from holding up an interaction
4
+ * Use this when you have a component which loads in late, but
5
+ * isn't considered to be a breach of SLO
6
+ *
7
+ * ```js
8
+ * <App>
9
+ * <Main />
10
+ * <Sidebar>
11
+ * <UFOInteractionIgnore>
12
+ * <InsightsButton />
13
+ * </UFOInteractionIgnore>
14
+ * </Sidebar>
15
+ * </App>
16
+ * ```
17
+ *
18
+ * Has an `ignore` prop, to allow you to use it conditionally
19
+ */
20
+ export default function UFOInteractionIgnore({ children, ignore, }: {
21
+ children?: ReactNode;
22
+ ignore?: boolean;
23
+ }): JSX.Element;
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/react-ufo/interaction-ignore",
3
+ "main": "../dist/cjs/interaction-ignore/index.js",
4
+ "module": "../dist/esm/interaction-ignore/index.js",
5
+ "module:es2019": "../dist/es2019/interaction-ignore/index.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/interaction-ignore/index.d.ts",
8
+ "typesVersions": {
9
+ ">=4.5 <5.4": {
10
+ "*": [
11
+ "../dist/types-ts4.5/interaction-ignore/index.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/react-ufo",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Parts of React UFO that are publicly available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -46,6 +46,7 @@
46
46
  "./initial-page-load-extra-timing": "./src/initial-page-load-extra-timing/index.ts",
47
47
  "./interaction-context": "./src/interaction-context/index.ts",
48
48
  "./interaction-id-context": "./src/interaction-id-context/index.ts",
49
+ "./interaction-ignore": "./src/interaction-ignore/index.ts",
49
50
  "./interaction-metrics": "./src/interaction-metrics/index.ts",
50
51
  "./interaction-metrics-init": "./src/interaction-metrics-init/index.ts",
51
52
  "./label": "./src/label/index.ts",
@@ -72,7 +73,7 @@
72
73
  ".": "./src/index.ts"
73
74
  },
74
75
  "dependencies": {
75
- "@atlaskit/interaction-context": "^2.1.0",
76
+ "@atlaskit/interaction-context": "^2.1.4",
76
77
  "@atlaskit/platform-feature-flags": "^0.3.0",
77
78
  "@babel/runtime": "^7.0.0",
78
79
  "bind-event-listener": "^3.0.0",