@atlaskit/onboarding 11.8.2 → 11.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atlaskit/onboarding
2
2
 
3
+ ## 11.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#117762](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/117762)
8
+ [`e7423e403d743`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e7423e403d743) -
9
+ [ux] Add `onBlanketClicked` prop to `SpotlightManager`.
10
+
11
+ ## 11.9.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`393f732d5423f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/393f732d5423f) -
16
+ [ux] Adding an optional prop to Spotlight, so it can used for scrollIntoView 'block' parameter.
17
+ This is to fix the unnecessary scroll of the non-portalled popup targets.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 11.8.2
4
24
 
5
25
  ### Patch Changes
@@ -27,7 +27,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
27
27
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
28
28
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
29
29
  var packageName = "@atlaskit/onboarding";
30
- var packageVersion = "11.8.2";
30
+ var packageVersion = "11.10.0";
31
31
  var SpotlightDialog = /*#__PURE__*/function (_Component) {
32
32
  (0, _inherits2.default)(SpotlightDialog, _Component);
33
33
  var _super = _createSuper(SpotlightDialog);
@@ -68,7 +68,8 @@ var SpotlightInner = /*#__PURE__*/function (_React$Component) {
68
68
  value: function componentDidUpdate(prevProps) {
69
69
  if (prevProps.targetNode !== this.props.targetNode) {
70
70
  (0, _scrollIntoViewIfNeeded.default)(this.props.targetNode, {
71
- scrollMode: 'if-needed'
71
+ scrollMode: 'if-needed',
72
+ block: this.props.scrollPositionBlock
72
73
  });
73
74
  }
74
75
  }
@@ -76,7 +77,8 @@ var SpotlightInner = /*#__PURE__*/function (_React$Component) {
76
77
  key: "componentDidMount",
77
78
  value: function componentDidMount() {
78
79
  (0, _scrollIntoViewIfNeeded.default)(this.props.targetNode, {
79
- scrollMode: 'if-needed'
80
+ scrollMode: 'if-needed',
81
+ block: this.props.scrollPositionBlock
80
82
  });
81
83
  this.props.onOpened();
82
84
  }
@@ -113,7 +113,8 @@ var SpotlightManager = exports.default = /*#__PURE__*/function (_PureComponent)
113
113
  var _this$props = this.props,
114
114
  blanketIsTinted = _this$props.blanketIsTinted,
115
115
  children = _this$props.children,
116
- Tag = _this$props.component;
116
+ Tag = _this$props.component,
117
+ onBlanketClicked = _this$props.onBlanketClicked;
117
118
  return /*#__PURE__*/_react.default.createElement(SpotlightStateProvider, {
118
119
  value: this.getStateProviderValue(this.state.targets)
119
120
  }, /*#__PURE__*/_react.default.createElement(TargetProvider, {
@@ -125,9 +126,11 @@ var SpotlightManager = exports.default = /*#__PURE__*/function (_PureComponent)
125
126
  }, function (animationStyles) {
126
127
  return /*#__PURE__*/_react.default.createElement(_portal.default, {
127
128
  zIndex: _constants.layers.spotlight()
128
- }, /*#__PURE__*/_react.default.createElement(_blanket.default, {
129
+ }, /*#__PURE__*/_react.default.createElement(_blanket.default
130
+ /* eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 */, {
129
131
  style: animationStyles,
130
- isTinted: blanketIsTinted
132
+ isTinted: blanketIsTinted,
133
+ onBlanketClicked: onBlanketClicked
131
134
  }));
132
135
  }), children)));
133
136
  }
@@ -33,13 +33,16 @@ var blanketStyles = (0, _react.css)({
33
33
  * @internal
34
34
  */
35
35
  var Blanket = function Blanket(props) {
36
+ var onBlanketClicked = props.onBlanketClicked;
36
37
  return (0, _react.jsx)("div", {
38
+ role: "presentation",
37
39
  css: blanketStyles
38
40
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
39
41
  ,
40
42
  style: _objectSpread(_objectSpread({}, props.style), {}, {
41
43
  backgroundColor: props.isTinted ? "var(--ds-blanket, ".concat(_colors.N100A, ")") : 'transparent'
42
- })
44
+ }),
45
+ onClick: onBlanketClicked
43
46
  });
44
47
  };
45
48
  var _default = exports.default = Blanket;
@@ -34,7 +34,7 @@ var pulseKeyframes = (0, _react.keyframes)({
34
34
  }
35
35
  });
36
36
  // This is needed for unit tests
37
- // eslint-disable-next-line @atlaskit/design-system/no-exported-keyframes, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
37
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
38
38
  var pulseKeyframesName = exports.pulseKeyframesName = pulseKeyframes.name;
39
39
  var animationStyles = (0, _react.css)({
40
40
  animation: "".concat(pulseKeyframes, " 3000ms ").concat(easing, " infinite"),
@@ -7,7 +7,7 @@ import { DialogImage } from '../styled/dialog';
7
7
  import SpotlightCard from './spotlight-card';
8
8
  import ValueChanged from './value-changed';
9
9
  const packageName = "@atlaskit/onboarding";
10
- const packageVersion = "11.8.2";
10
+ const packageVersion = "11.10.0";
11
11
  class SpotlightDialog extends Component {
12
12
  constructor(...args) {
13
13
  super(...args);
@@ -42,13 +42,15 @@ class SpotlightInner extends React.Component {
42
42
  componentDidUpdate(prevProps) {
43
43
  if (prevProps.targetNode !== this.props.targetNode) {
44
44
  scrollIntoView(this.props.targetNode, {
45
- scrollMode: 'if-needed'
45
+ scrollMode: 'if-needed',
46
+ block: this.props.scrollPositionBlock
46
47
  });
47
48
  }
48
49
  }
49
50
  componentDidMount() {
50
51
  scrollIntoView(this.props.targetNode, {
51
- scrollMode: 'if-needed'
52
+ scrollMode: 'if-needed',
53
+ block: this.props.scrollPositionBlock
52
54
  });
53
55
  this.props.onOpened();
54
56
  }
@@ -78,7 +78,8 @@ export default class SpotlightManager extends PureComponent {
78
78
  const {
79
79
  blanketIsTinted,
80
80
  children,
81
- component: Tag
81
+ component: Tag,
82
+ onBlanketClicked
82
83
  } = this.props;
83
84
  return /*#__PURE__*/React.createElement(SpotlightStateProvider, {
84
85
  value: this.getStateProviderValue(this.state.targets)
@@ -90,9 +91,11 @@ export default class SpotlightManager extends PureComponent {
90
91
  hasEntered: this.state.spotlightCount > 0
91
92
  }, animationStyles => /*#__PURE__*/React.createElement(Portal, {
92
93
  zIndex: layers.spotlight()
93
- }, /*#__PURE__*/React.createElement(Blanket, {
94
+ }, /*#__PURE__*/React.createElement(Blanket
95
+ /* eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 */, {
94
96
  style: animationStyles,
95
- isTinted: blanketIsTinted
97
+ isTinted: blanketIsTinted,
98
+ onBlanketClicked: onBlanketClicked
96
99
  }))), children)));
97
100
  }
98
101
  }
@@ -26,14 +26,19 @@ const blanketStyles = css({
26
26
  * @internal
27
27
  */
28
28
  const Blanket = props => {
29
+ const {
30
+ onBlanketClicked
31
+ } = props;
29
32
  return jsx("div", {
33
+ role: "presentation",
30
34
  css: blanketStyles
31
35
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
32
36
  ,
33
37
  style: {
34
38
  ...props.style,
35
39
  backgroundColor: props.isTinted ? `var(--ds-blanket, ${N100A})` : 'transparent'
36
- }
40
+ },
41
+ onClick: onBlanketClicked
37
42
  });
38
43
  };
39
44
  export default Blanket;
@@ -21,7 +21,7 @@ const pulseKeyframes = keyframes({
21
21
  }
22
22
  });
23
23
  // This is needed for unit tests
24
- // eslint-disable-next-line @atlaskit/design-system/no-exported-keyframes, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
24
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
25
25
  export const pulseKeyframesName = pulseKeyframes.name;
26
26
  const animationStyles = css({
27
27
  animation: `${pulseKeyframes} 3000ms ${easing} infinite`,
@@ -17,7 +17,7 @@ import { DialogImage } from '../styled/dialog';
17
17
  import SpotlightCard from './spotlight-card';
18
18
  import ValueChanged from './value-changed';
19
19
  var packageName = "@atlaskit/onboarding";
20
- var packageVersion = "11.8.2";
20
+ var packageVersion = "11.10.0";
21
21
  var SpotlightDialog = /*#__PURE__*/function (_Component) {
22
22
  _inherits(SpotlightDialog, _Component);
23
23
  var _super = _createSuper(SpotlightDialog);
@@ -61,7 +61,8 @@ var SpotlightInner = /*#__PURE__*/function (_React$Component) {
61
61
  value: function componentDidUpdate(prevProps) {
62
62
  if (prevProps.targetNode !== this.props.targetNode) {
63
63
  scrollIntoView(this.props.targetNode, {
64
- scrollMode: 'if-needed'
64
+ scrollMode: 'if-needed',
65
+ block: this.props.scrollPositionBlock
65
66
  });
66
67
  }
67
68
  }
@@ -69,7 +70,8 @@ var SpotlightInner = /*#__PURE__*/function (_React$Component) {
69
70
  key: "componentDidMount",
70
71
  value: function componentDidMount() {
71
72
  scrollIntoView(this.props.targetNode, {
72
- scrollMode: 'if-needed'
73
+ scrollMode: 'if-needed',
74
+ block: this.props.scrollPositionBlock
73
75
  });
74
76
  this.props.onOpened();
75
77
  }
@@ -105,7 +105,8 @@ var SpotlightManager = /*#__PURE__*/function (_PureComponent) {
105
105
  var _this$props = this.props,
106
106
  blanketIsTinted = _this$props.blanketIsTinted,
107
107
  children = _this$props.children,
108
- Tag = _this$props.component;
108
+ Tag = _this$props.component,
109
+ onBlanketClicked = _this$props.onBlanketClicked;
109
110
  return /*#__PURE__*/React.createElement(SpotlightStateProvider, {
110
111
  value: this.getStateProviderValue(this.state.targets)
111
112
  }, /*#__PURE__*/React.createElement(TargetProvider, {
@@ -117,9 +118,11 @@ var SpotlightManager = /*#__PURE__*/function (_PureComponent) {
117
118
  }, function (animationStyles) {
118
119
  return /*#__PURE__*/React.createElement(Portal, {
119
120
  zIndex: layers.spotlight()
120
- }, /*#__PURE__*/React.createElement(Blanket, {
121
+ }, /*#__PURE__*/React.createElement(Blanket
122
+ /* eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766 */, {
121
123
  style: animationStyles,
122
- isTinted: blanketIsTinted
124
+ isTinted: blanketIsTinted,
125
+ onBlanketClicked: onBlanketClicked
123
126
  }));
124
127
  }), children)));
125
128
  }
@@ -29,13 +29,16 @@ var blanketStyles = css({
29
29
  * @internal
30
30
  */
31
31
  var Blanket = function Blanket(props) {
32
+ var onBlanketClicked = props.onBlanketClicked;
32
33
  return jsx("div", {
34
+ role: "presentation",
33
35
  css: blanketStyles
34
36
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
35
37
  ,
36
38
  style: _objectSpread(_objectSpread({}, props.style), {}, {
37
39
  backgroundColor: props.isTinted ? "var(--ds-blanket, ".concat(N100A, ")") : 'transparent'
38
- })
40
+ }),
41
+ onClick: onBlanketClicked
39
42
  });
40
43
  };
41
44
  export default Blanket;
@@ -28,7 +28,7 @@ var pulseKeyframes = keyframes({
28
28
  }
29
29
  });
30
30
  // This is needed for unit tests
31
- // eslint-disable-next-line @atlaskit/design-system/no-exported-keyframes, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
31
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766
32
32
  export var pulseKeyframesName = pulseKeyframes.name;
33
33
  var animationStyles = css({
34
34
  animation: "".concat(pulseKeyframes, " 3000ms ").concat(easing, " infinite"),
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type ScrollLogicalPosition } from '../types';
2
3
  import { type ElementBoundingBox } from '../utils/use-element-box';
3
4
  import { type SpotlightProps } from './spotlight';
4
5
  export interface SpotlightInnerProps extends SpotlightProps {
@@ -26,6 +27,10 @@ export interface SpotlightInnerProps extends SpotlightProps {
26
27
  * Same as `SpotlightProps` but required instead of optional.
27
28
  */
28
29
  dialogWidth: number;
30
+ /**
31
+ * passed to scrollIntoView as the block option, which determines the vertical alignment of the target node in the closest scrollable ancestor.
32
+ */
33
+ scrollPositionBlock?: ScrollLogicalPosition;
29
34
  }
30
35
  interface State {
31
36
  replacementElement: HTMLElement | null;
@@ -30,6 +30,10 @@ interface SpotlightManagerProps {
30
30
  * Component is deprecated and will be removed in the future.
31
31
  */
32
32
  component?: ElementType;
33
+ /**
34
+ * Handler function to be called when the blanket is clicked.
35
+ */
36
+ onBlanketClicked?: () => void;
33
37
  }
34
38
  /**
35
39
  * __Spotlight manager__
@@ -1,5 +1,5 @@
1
1
  import { type ComponentType, type MouseEvent, type ReactNode } from 'react';
2
- import { type Actions } from '../types';
2
+ import { type Actions, type ScrollLogicalPosition } from '../types';
3
3
  export interface SpotlightProps {
4
4
  /**
5
5
  * Buttons to render in the footer.
@@ -82,6 +82,10 @@ export interface SpotlightProps {
82
82
  Defaults to `"spotlight"`.
83
83
  */
84
84
  testId?: string;
85
+ /**
86
+ * Used set the 'block' attribute on scrollIntoView, which determines the vertical alignment of the target node to the nearest scrollable ancestor.
87
+ */
88
+ scrollPositionBlock?: ScrollLogicalPosition;
85
89
  }
86
90
  /**
87
91
  * __Spotlight__
@@ -7,6 +7,7 @@ import { jsx } from '@emotion/react';
7
7
  type BlanketProps = {
8
8
  isTinted?: boolean;
9
9
  style?: React.CSSProperties;
10
+ onBlanketClicked?: () => void;
10
11
  };
11
12
  /**
12
13
  * __Blanket__
@@ -5,4 +5,4 @@ interface Action extends Omit<CustomThemeButtonProps, 'children'> {
5
5
  text?: ReactNode;
6
6
  }
7
7
  export type Actions = Action[];
8
- export {};
8
+ export type { ScrollLogicalPosition } from 'scroll-into-view-if-needed/typings/types';
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type ScrollLogicalPosition } from '../types';
2
3
  import { type ElementBoundingBox } from '../utils/use-element-box';
3
4
  import { type SpotlightProps } from './spotlight';
4
5
  export interface SpotlightInnerProps extends SpotlightProps {
@@ -26,6 +27,10 @@ export interface SpotlightInnerProps extends SpotlightProps {
26
27
  * Same as `SpotlightProps` but required instead of optional.
27
28
  */
28
29
  dialogWidth: number;
30
+ /**
31
+ * passed to scrollIntoView as the block option, which determines the vertical alignment of the target node in the closest scrollable ancestor.
32
+ */
33
+ scrollPositionBlock?: ScrollLogicalPosition;
29
34
  }
30
35
  interface State {
31
36
  replacementElement: HTMLElement | null;
@@ -30,6 +30,10 @@ interface SpotlightManagerProps {
30
30
  * Component is deprecated and will be removed in the future.
31
31
  */
32
32
  component?: ElementType;
33
+ /**
34
+ * Handler function to be called when the blanket is clicked.
35
+ */
36
+ onBlanketClicked?: () => void;
33
37
  }
34
38
  /**
35
39
  * __Spotlight manager__
@@ -1,5 +1,5 @@
1
1
  import { type ComponentType, type MouseEvent, type ReactNode } from 'react';
2
- import { type Actions } from '../types';
2
+ import { type Actions, type ScrollLogicalPosition } from '../types';
3
3
  export interface SpotlightProps {
4
4
  /**
5
5
  * Buttons to render in the footer.
@@ -82,6 +82,10 @@ export interface SpotlightProps {
82
82
  Defaults to `"spotlight"`.
83
83
  */
84
84
  testId?: string;
85
+ /**
86
+ * Used set the 'block' attribute on scrollIntoView, which determines the vertical alignment of the target node to the nearest scrollable ancestor.
87
+ */
88
+ scrollPositionBlock?: ScrollLogicalPosition;
85
89
  }
86
90
  /**
87
91
  * __Spotlight__
@@ -7,6 +7,7 @@ import { jsx } from '@emotion/react';
7
7
  type BlanketProps = {
8
8
  isTinted?: boolean;
9
9
  style?: React.CSSProperties;
10
+ onBlanketClicked?: () => void;
10
11
  };
11
12
  /**
12
13
  * __Blanket__
@@ -5,4 +5,4 @@ interface Action extends Omit<CustomThemeButtonProps, 'children'> {
5
5
  text?: ReactNode;
6
6
  }
7
7
  export type Actions = Action[];
8
- export {};
8
+ export type { ScrollLogicalPosition } from 'scroll-into-view-if-needed/typings/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/onboarding",
3
- "version": "11.8.2",
3
+ "version": "11.10.0",
4
4
  "description": "An onboarding spotlight introduces new features to users through focused messages or multi-step tours.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@atlaskit/analytics-next": "^9.3.0",
44
- "@atlaskit/button": "^18.0.0",
44
+ "@atlaskit/button": "^18.2.0",
45
45
  "@atlaskit/ds-lib": "^2.3.0",
46
46
  "@atlaskit/heading": "^2.4.0",
47
47
  "@atlaskit/modal-dialog": "^12.14.0",