@atlaskit/onboarding 10.4.1 → 10.5.1

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 (49) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/components/modal.js +13 -16
  3. package/dist/cjs/components/spotlight-card.js +133 -100
  4. package/dist/cjs/components/spotlight-dialog.js +6 -18
  5. package/dist/cjs/components/spotlight-manager.js +8 -6
  6. package/dist/cjs/components/spotlight-target.js +4 -2
  7. package/dist/cjs/components/spotlight-transition.js +7 -3
  8. package/dist/cjs/components/spotlight.js +4 -4
  9. package/dist/cjs/components/theme.js +10 -0
  10. package/dist/cjs/components/use-spotlight.js +1 -7
  11. package/dist/cjs/styled/target.js +5 -3
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/es2019/components/modal.js +6 -9
  14. package/dist/es2019/components/spotlight-card.js +120 -63
  15. package/dist/es2019/components/spotlight-dialog.js +8 -17
  16. package/dist/es2019/components/spotlight-manager.js +5 -5
  17. package/dist/es2019/components/spotlight-target.js +4 -2
  18. package/dist/es2019/components/spotlight-transition.js +6 -3
  19. package/dist/es2019/components/spotlight.js +4 -4
  20. package/dist/es2019/components/theme.js +10 -0
  21. package/dist/es2019/components/use-spotlight.js +1 -7
  22. package/dist/es2019/styled/target.js +5 -3
  23. package/dist/es2019/version.json +1 -1
  24. package/dist/esm/components/modal.js +13 -16
  25. package/dist/esm/components/spotlight-card.js +120 -90
  26. package/dist/esm/components/spotlight-dialog.js +6 -16
  27. package/dist/esm/components/spotlight-manager.js +5 -4
  28. package/dist/esm/components/spotlight-target.js +4 -2
  29. package/dist/esm/components/spotlight-transition.js +6 -3
  30. package/dist/esm/components/spotlight.js +4 -4
  31. package/dist/esm/components/theme.js +10 -0
  32. package/dist/esm/components/use-spotlight.js +1 -7
  33. package/dist/esm/styled/target.js +5 -3
  34. package/dist/esm/version.json +1 -1
  35. package/dist/types/components/modal.d.ts +6 -5
  36. package/dist/types/components/spotlight-card.d.ts +25 -7
  37. package/dist/types/components/spotlight-manager.d.ts +5 -3
  38. package/dist/types/components/spotlight-target.d.ts +4 -2
  39. package/dist/types/components/spotlight-transition.d.ts +4 -2
  40. package/dist/types/components/spotlight.d.ts +4 -4
  41. package/dist/types/components/theme.d.ts +8 -0
  42. package/dist/types/components/use-spotlight.d.ts +1 -7
  43. package/dist/types/styled/target.d.ts +5 -3
  44. package/package.json +5 -3
  45. package/report.api.md +406 -0
  46. package/dist/cjs/components/card.js +0 -160
  47. package/dist/es2019/components/card.js +0 -131
  48. package/dist/esm/components/card.js +0 -142
  49. package/dist/types/components/card.d.ts +0 -59
@@ -1,72 +1,129 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
- import React from 'react';
4
- import { Theme as ButtonTheme } from '@atlaskit/button/custom-theme-button';
1
+ /** @jsx jsx */
2
+ import React, { forwardRef } from 'react';
3
+ import { css, jsx } from '@emotion/core';
4
+ import Button, { Theme as ButtonTheme } from '@atlaskit/button/custom-theme-button';
5
+ import Heading from '@atlaskit/heading';
5
6
  import { N0, N50A, N60A, P300 } from '@atlaskit/theme/colors';
6
- import Card from './card';
7
+ import { createTheme } from '@atlaskit/theme/components';
8
+ import { borderRadius, gridSize as getGridSize, layers } from '@atlaskit/theme/constants';
9
+ import { DialogActionItem, DialogActionItemContainer } from '../styled/dialog';
7
10
  import { spotlightButtonTheme } from './theme';
11
+ const gridSize = getGridSize();
12
+ const bodyStyles = css({
13
+ display: 'flex',
14
+ padding: `${gridSize * 2}px ${gridSize * 2.5}px`,
15
+ flexDirection: 'column'
16
+ });
17
+ const defaultHeaderStyles = css({
18
+ display: 'flex',
19
+ paddingBottom: `${gridSize}px`,
20
+ alignItems: 'baseline',
21
+ justifyContent: 'space-between'
22
+ });
23
+
24
+ const DefaultHeader = ({
25
+ children
26
+ }) => jsx("div", {
27
+ css: defaultHeaderStyles
28
+ }, children);
29
+
30
+ const defaultFooterStyles = css({
31
+ display: 'flex',
32
+ paddingTop: `${gridSize}px`,
33
+ alignItems: 'center',
34
+ justifyContent: 'space-between'
35
+ });
8
36
 
9
- class SpotlightCard extends React.Component {
10
- render() {
11
- const {
12
- actions,
13
- actionsBeforeElement,
14
- children,
15
- components,
16
- isFlat,
17
- heading,
18
- headingAfterElement,
19
- image,
20
- innerRef,
21
- theme,
22
- width,
23
- testId
24
- } = this.props;
25
- return /*#__PURE__*/React.createElement(ButtonTheme.Provider, {
26
- value: spotlightButtonTheme
27
- }, /*#__PURE__*/React.createElement(Card, {
28
- testId: testId,
29
- ref: innerRef,
30
- heading: heading,
31
- headingAfterElement: headingAfterElement,
32
- actions: actions,
33
- actionsBeforeElement: actionsBeforeElement,
34
- components: components,
35
- image: image // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
36
- ,
37
- theme: parent => {
38
- const {
39
- container,
40
- ...others
41
- } = parent({});
42
- return theme(() => ({ ...others,
43
- container: {
44
- background: `var(--ds-background-discovery-bold, ${P300})`,
45
- color: `var(--ds-text-inverse, ${N0})`,
46
- width: `${Math.min(Math.max(width, 160), 600)}px`,
47
- boxShadow: isFlat ? undefined : `var(--ds-shadow-raised, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`,
48
- ...container
49
- }
50
- }), {});
51
- }
52
- }, children));
53
- }
37
+ const DefaultFooter = ({
38
+ children
39
+ }) => jsx("div", {
40
+ css: defaultFooterStyles
41
+ }, children);
54
42
 
55
- }
43
+ const containerStyles = css({
44
+ height: 'fit-content',
45
+ zIndex: layers.spotlight() + 1,
46
+ background: `var(--ds-background-discovery-bold, ${P300})`,
47
+ borderRadius: `${borderRadius()}px`,
48
+ color: `var(--ds-text-inverse, ${N0})`,
49
+ overflow: 'auto'
50
+ });
51
+ const containerShadowStyles = css({
52
+ boxShadow: `var(--ds-shadow-raised, ${`0 4px 8px -2px ${N50A}, 0 0 1px ${N60A}`})`
53
+ });
56
54
  /**
57
- * __Spotlight card__
58
- *
59
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
55
+ * @deprecated
60
56
  */
61
57
 
58
+ const Theme = createTheme(() => ({
59
+ container: {}
60
+ }));
61
+ /**
62
+ * @deprecated
63
+ */
62
64
 
63
- _defineProperty(SpotlightCard, "defaultProps", {
64
- width: 400,
65
- isFlat: false,
66
- components: {},
67
- theme: themeFn => themeFn()
65
+ /**
66
+ * __Spotlight card__
67
+ *
68
+ * A spotlight card is for onboarding messages that need a more flexible layout, or don't require a dialog.
69
+ *
70
+ * - [Examples](https://atlassian.design/components/onboarding/spotlight-card/examples)
71
+ * - [Code](https://atlassian.design/components/onboarding/spotlight-card/code)
72
+ * - [Usage](https://atlassian.design/components/onboarding/spotlight-card/usage)
73
+ */
74
+ const SpotlightCard = /*#__PURE__*/forwardRef((props, ref) => {
75
+ const {
76
+ actions = [],
77
+ actionsBeforeElement,
78
+ children,
79
+ components = {},
80
+ heading,
81
+ headingAfterElement,
82
+ image,
83
+ innerRef,
84
+ isFlat,
85
+ testId,
86
+ theme,
87
+ width = 400
88
+ } = props;
89
+ const {
90
+ Header = DefaultHeader,
91
+ Footer = DefaultFooter
92
+ } = components;
93
+ return jsx(ButtonTheme.Provider, {
94
+ value: spotlightButtonTheme
95
+ }, jsx(Theme.Provider, {
96
+ value: theme
97
+ }, jsx(Theme.Consumer, null, ({
98
+ container
99
+ }) => {
100
+ return jsx("div", {
101
+ css: [containerStyles, !isFlat && containerShadowStyles, // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
102
+ container],
103
+ style: {
104
+ width: `${Math.min(Math.max(width, 160), 600)}px`
105
+ },
106
+ ref: ref || innerRef,
107
+ "data-testid": testId
108
+ }, typeof image === 'string' ? jsx("img", {
109
+ src: image,
110
+ alt: ""
111
+ }) : image, jsx("div", {
112
+ css: bodyStyles
113
+ }, heading || headingAfterElement ? jsx(Header, null, jsx(Heading, {
114
+ color: "inverse",
115
+ level: "h600",
116
+ as: "h4"
117
+ }, heading), headingAfterElement) : null, children, actions.length > 0 || actionsBeforeElement ? jsx(Footer, null, actionsBeforeElement || jsx("span", null), jsx(DialogActionItemContainer, null, actions.map(({
118
+ text,
119
+ key,
120
+ ...rest
121
+ }, idx) => {
122
+ return jsx(DialogActionItem, {
123
+ key: key || (typeof text === 'string' ? text : `${idx}`)
124
+ }, jsx(Button, rest, text));
125
+ }))) : null));
126
+ })));
68
127
  });
69
-
70
- export default /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(SpotlightCard, _extends({}, props, {
71
- innerRef: ref
72
- })));
128
+ SpotlightCard.displayName = 'SpotlightCard';
129
+ export default SpotlightCard;
@@ -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 = "10.4.1";
10
+ const packageVersion = "10.5.1";
11
11
 
12
12
  class SpotlightDialog extends Component {
13
13
  constructor(...args) {
@@ -92,22 +92,13 @@ class SpotlightDialog extends Component {
92
92
  disabled: focusLockDisabled,
93
93
  returnFocus: false,
94
94
  autoFocus: true
95
- }, /*#__PURE__*/React.createElement(SpotlightCard, {
95
+ }, /*#__PURE__*/React.createElement("div", {
96
96
  ref: ref,
97
- testId: testId // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
98
- ,
99
- theme: parent => {
100
- const {
101
- container,
102
- ...others
103
- } = parent({});
104
- return { ...others,
105
- container: { ...container,
106
- ...style,
107
- ...animationStyles
108
- }
109
- };
110
- },
97
+ style: { ...style,
98
+ ...animationStyles
99
+ }
100
+ }, /*#__PURE__*/React.createElement(SpotlightCard, {
101
+ testId: testId,
111
102
  width: dialogWidth,
112
103
  actions: actions,
113
104
  actionsBeforeElement: actionsBeforeElement,
@@ -121,7 +112,7 @@ class SpotlightDialog extends Component {
121
112
  },
122
113
  heading: heading,
123
114
  headingAfterElement: headingAfterElement
124
- }, children))));
115
+ }, children)))));
125
116
  }
126
117
 
127
118
  }
@@ -1,13 +1,11 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { createContext, PureComponent } from 'react';
3
3
  import memoizeOne from 'memoize-one';
4
+ import noop from '@atlaskit/ds-lib/noop';
4
5
  import Portal from '@atlaskit/portal';
5
6
  import { layers } from '@atlaskit/theme/constants';
6
7
  import Blanket from '../styled/blanket';
7
8
  import { Fade } from './animation';
8
-
9
- const noop = () => {};
10
-
11
9
  const {
12
10
  Consumer: TargetConsumer,
13
11
  Provider: TargetProvider
@@ -31,9 +29,11 @@ const Container = ({
31
29
  /**
32
30
  * __Spotlight manager__
33
31
  *
34
- * Wraps usage of spotlight and manages progression through multiple spotlights.
32
+ * A spotlight manager manages the visibility of spotlights used to introduce new features to users through focused messages or multi-step tours.
35
33
  *
36
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
34
+ * - [Examples](https://atlassian.design/components/onboarding/examples)
35
+ * - [Code](https://atlassian.design/components/onboarding/code)
36
+ * - [Usage](https://atlassian.design/components/onboarding/usage)
37
37
  */
38
38
 
39
39
 
@@ -5,9 +5,11 @@ import { TargetConsumer } from './spotlight-manager';
5
5
  /**
6
6
  * __Spotlight target__
7
7
  *
8
- * Wraps an element, allowing it to be targeted by a spotlight.
8
+ * A spotlight target marks a component to be used for introducing new features to users through focused messages or multi-step tours.
9
9
  *
10
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
10
+ * - [Examples](https://atlassian.design/components/onboarding/examples)
11
+ * - [Code](https://atlassian.design/components/onboarding/code)
12
+ * - [Usage](https://atlassian.design/components/onboarding/usage)
11
13
  */
12
14
  const SpotlightTarget = ({
13
15
  children,
@@ -1,17 +1,20 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { createContext } from 'react';
3
+ import noop from '@atlaskit/ds-lib/noop';
3
4
  const SpotlightTransitionContext = /*#__PURE__*/createContext({
4
5
  isOpen: true,
5
- onExited: () => {}
6
+ onExited: noop
6
7
  }); // checks if children exist and are truthy
7
8
 
8
9
  const hasChildren = children => React.Children.count(children) > 0 && React.Children.map(children, child => !!child).filter(Boolean).length > 0;
9
10
  /**
10
11
  * __Spotlight transition__
11
12
  *
12
- * Provides context used for fading animations.
13
+ * A spotlight transition holds onto spotlights so they can fade out when exiting the viewport.
13
14
  *
14
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
15
+ * - [Examples](https://atlassian.design/components/onboarding/examples)
16
+ * - [Code](https://atlassian.design/components/onboarding/code)
17
+ * - [Usage](https://atlassian.design/components/onboarding/usage)
15
18
  */
16
19
 
17
20
 
@@ -6,11 +6,11 @@ import { SpotlightConsumer } from './spotlight-manager';
6
6
  /**
7
7
  * __Spotlight__
8
8
  *
9
- * A spotlight gives visual focus to an element and is paired with a dialog.
9
+ * An onboarding spotlight introduces new features to users through focused messages or multi-step tours.
10
10
  *
11
- * Spotlights are used for onboarding and can be connected to create a tour.
12
- *
13
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
11
+ * - [Examples](https://atlassian.design/components/onboarding/examples)
12
+ * - [Code](https://atlassian.design/components/onboarding/code)
13
+ * - [Usage](https://atlassian.design/components/onboarding/usage)
14
14
  */
15
15
  const Spotlight = ({
16
16
  dialogWidth = 400,
@@ -136,6 +136,11 @@ function extract(newTheme, {
136
136
  return acc;
137
137
  }, {});
138
138
  }
139
+ /**
140
+ * @deprecated
141
+ * Custom button themes are deprecated and will be removed in the future.
142
+ */
143
+
139
144
 
140
145
  export const spotlightButtonTheme = (current, themeProps) => {
141
146
  const {
@@ -149,6 +154,11 @@ export const spotlightButtonTheme = (current, themeProps) => {
149
154
  ...rest
150
155
  };
151
156
  };
157
+ /**
158
+ * @deprecated
159
+ * Custom button themes are deprecated and will be removed in the future.
160
+ */
161
+
152
162
  export const modalButtonTheme = (current, themeProps) => {
153
163
  const {
154
164
  buttonStyles,
@@ -1,13 +1,7 @@
1
1
  import { useCallback, useContext, useEffect, useMemo, useRef } from 'react';
2
2
  import { SpotlightContext } from './spotlight-manager';
3
3
  /**
4
- * Enables advanced usage of spotlights.
5
- *
6
- * Provides the following methods:
7
- * - `isTargetRendered`
8
- *
9
- * Checks if the given spotlight target is currently
10
- * being rendered.
4
+ * Use spotlight hook returns information about available spotlight targets.
11
5
  */
12
6
 
13
7
  export default function useSpotlight() {
@@ -83,11 +83,13 @@ export const TargetOverlay = props => jsx("div", _extends({}, props, {
83
83
  }
84
84
  }));
85
85
  /**
86
- * __Pulse__
86
+ * __Spotlight pulse__
87
87
  *
88
- * Allows consumers to apply the spotlight pulse effect in a custom way.
88
+ * A spotlight pulse draws attention to a new feature.
89
89
  *
90
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
90
+ * - [Examples](https://atlassian.design/components/onboarding/examples)
91
+ * - [Code](https://atlassian.design/components/onboarding/code)
92
+ * - [Usage](https://atlassian.design/components/onboarding/usage)
91
93
  */
92
94
 
93
95
  export const Pulse = ({
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/onboarding",
3
- "version": "10.4.1",
3
+ "version": "10.5.1",
4
4
  "sideEffects": false
5
5
  }
@@ -22,26 +22,24 @@ import Modal, { ModalBody } from '@atlaskit/modal-dialog';
22
22
  import { ModalBody as Body, ModalHeading as Heading, ModalActionContainer, ModalActionItem, ModalImage } from '../styled/modal';
23
23
  import { modalButtonTheme } from './theme'; // TODO: DSP-1250 - use a composable API consistent with normal modal dialog
24
24
 
25
- function noop() {}
26
25
  /**
27
- * __Onboarding modal__
26
+ * __Benefits modal__
28
27
  *
29
- * If the product change is large enough,
30
- * this component can be used to outline the benefits of the change to the user.
28
+ * A benefits modal explains the benefits of a significant new feature or experience change.
31
29
  *
32
- * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
30
+ * - [Examples](https://atlassian.design/components/onboarding/benefits-modal/examples)
31
+ * - [Code](https://atlassian.design/components/onboarding/benefits-modal/code)
32
+ * - [Usage](https://atlassian.design/components/onboarding/benefits-modal/usage)
33
33
  */
34
+ var BenefitsModal = /*#__PURE__*/function (_Component) {
35
+ _inherits(BenefitsModal, _Component);
34
36
 
37
+ var _super = _createSuper(BenefitsModal);
35
38
 
36
- var OnboardingModal = /*#__PURE__*/function (_Component) {
37
- _inherits(OnboardingModal, _Component);
38
-
39
- var _super = _createSuper(OnboardingModal);
40
-
41
- function OnboardingModal() {
39
+ function BenefitsModal() {
42
40
  var _this;
43
41
 
44
- _classCallCheck(this, OnboardingModal);
42
+ _classCallCheck(this, BenefitsModal);
45
43
 
46
44
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
47
45
  args[_key] = arguments[_key];
@@ -95,7 +93,7 @@ var OnboardingModal = /*#__PURE__*/function (_Component) {
95
93
  return _this;
96
94
  }
97
95
 
98
- _createClass(OnboardingModal, [{
96
+ _createClass(BenefitsModal, [{
99
97
  key: "render",
100
98
  value: function render() {
101
99
  var _this$props = this.props,
@@ -108,7 +106,6 @@ var OnboardingModal = /*#__PURE__*/function (_Component) {
108
106
  var Footer = this.footerComponent(this.props);
109
107
  return jsx(Modal, _extends({
110
108
  autoFocus: true,
111
- onClose: noop,
112
109
  shouldScrollInViewport: true,
113
110
  shouldCloseOnOverlayClick: false,
114
111
  shouldCloseOnEscapePress: false
@@ -116,7 +113,7 @@ var OnboardingModal = /*#__PURE__*/function (_Component) {
116
113
  }
117
114
  }]);
118
115
 
119
- return OnboardingModal;
116
+ return BenefitsModal;
120
117
  }(Component);
121
118
 
122
- export { OnboardingModal as default };
119
+ export { BenefitsModal as default };