@atlaskit/onboarding 10.4.2 → 10.5.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.
Files changed (49) hide show
  1. package/CHANGELOG.md +11 -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 +4 -2
  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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/onboarding",
3
- "version": "10.4.2",
3
+ "version": "10.5.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/"
@@ -27,6 +27,8 @@
27
27
  "dependencies": {
28
28
  "@atlaskit/analytics-next": "^8.0.0",
29
29
  "@atlaskit/button": "^16.3.0",
30
+ "@atlaskit/ds-lib": "^2.1.0",
31
+ "@atlaskit/heading": "^0.1.12",
30
32
  "@atlaskit/modal-dialog": "^12.2.0",
31
33
  "@atlaskit/popper": "^5.0.0",
32
34
  "@atlaskit/portal": "^4.0.0",
@@ -52,7 +54,7 @@
52
54
  "@atlaskit/docs": "*",
53
55
  "@atlaskit/icon": "^21.10.0",
54
56
  "@atlaskit/progress-indicator": "^9.2.0",
55
- "@atlaskit/select": "^15.3.0",
57
+ "@atlaskit/select": "^15.5.0",
56
58
  "@atlaskit/ssr": "*",
57
59
  "@atlaskit/visual-regression": "*",
58
60
  "@atlaskit/webdriver-runner": "*",
package/report.api.md ADDED
@@ -0,0 +1,406 @@
1
+ ## API Report File for "@atlaskit/onboarding"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+ /// <reference types="react" />
7
+
8
+ import { Component } from 'react';
9
+ import { ComponentType } from 'react';
10
+ import { CustomThemeButtonProps } from '@atlaskit/button/types';
11
+ import { ElementType } from 'react';
12
+ import { MemoizedFn } from 'memoize-one';
13
+ import { ModalFooterProps } from '@atlaskit/modal-dialog';
14
+ import { ModalHeaderProps } from '@atlaskit/modal-dialog';
15
+ import { default as ModalTransition } from '@atlaskit/modal-dialog/modal-transition';
16
+ import { MouseEvent as MouseEvent_2 } from 'react';
17
+ import { PureComponent } from 'react';
18
+ import { default as React_2 } from 'react';
19
+ import { ReactNode } from 'react';
20
+ import { Ref } from 'react';
21
+ import { ThemeProp } from '@atlaskit/theme/components';
22
+
23
+ declare interface Action extends Omit<CustomThemeButtonProps, 'children'> {
24
+ key?: string;
25
+ text?: ReactNode;
26
+ }
27
+
28
+ declare type Actions = Action[];
29
+
30
+ declare type BaseProps = React.HTMLAttributes<HTMLDivElement> & {
31
+ bgColor?: string;
32
+ radius?: number;
33
+ className?: string;
34
+ testId?: string;
35
+ };
36
+
37
+ declare interface CardTokens {
38
+ container: Record<string, string | undefined>;
39
+ }
40
+
41
+ /**
42
+ * __Onboarding modal__
43
+ *
44
+ * If the product change is large enough,
45
+ * this component can be used to outline the benefits of the change to the user.
46
+ *
47
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
48
+ */
49
+ export declare class Modal extends Component<ModalProps> {
50
+ headerComponent: (
51
+ props: ModalProps,
52
+ ) => ElementType<ModalHeaderProps> | (() => JSX.Element);
53
+ footerComponent: (
54
+ props: ModalProps,
55
+ ) => ElementType<ModalFooterProps> | (() => JSX.Element | null);
56
+ render(): JSX.Element;
57
+ }
58
+
59
+ export declare const modalButtonTheme: (
60
+ current: any,
61
+ themeProps: Record<string, any>,
62
+ ) => any;
63
+
64
+ declare type ModalProps = {
65
+ /**
66
+ * Buttons to render in the footer
67
+ */
68
+ actions?: Actions;
69
+ /**
70
+ * The elements rendered in the modal
71
+ */
72
+ children: ReactNode;
73
+ /**
74
+ * Path to the the your image
75
+ */
76
+ image?: string;
77
+ /**
78
+ * Optional element rendered above the body
79
+ */
80
+ header?: ElementType<ModalHeaderProps>;
81
+ /**
82
+ * Optional element rendered below the body
83
+ */
84
+ footer?: ElementType<ModalFooterProps>;
85
+ /**
86
+ * Heading text rendered above the body
87
+ */
88
+ heading?: string;
89
+ /**
90
+ * Boolean prop to confirm if primary button in the footer should be shown on the right
91
+ */
92
+ experimental_shouldShowPrimaryButtonOnRight?: boolean;
93
+ };
94
+
95
+ export { ModalTransition };
96
+
97
+ /**
98
+ * __Spotlight__
99
+ *
100
+ * A spotlight gives visual focus to an element and is paired with a dialog.
101
+ *
102
+ * Spotlights are used for onboarding and can be connected to create a tour.
103
+ *
104
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
105
+ */
106
+ export declare const Spotlight: React_2.FC<SpotlightProps>;
107
+
108
+ export declare const spotlightButtonTheme: (
109
+ current: any,
110
+ themeProps: Record<string, any>,
111
+ ) => any;
112
+
113
+ export declare const SpotlightCard: React_2.ForwardRefExoticComponent<
114
+ SpotlightCardProps & React_2.RefAttributes<HTMLElement>
115
+ >;
116
+
117
+ declare interface SpotlightCardProps {
118
+ /**
119
+ * Buttons to render in the footer
120
+ */
121
+ actions?: Actions;
122
+ /**
123
+ * An optional element rendered to the left of the footer actions
124
+ */
125
+ actionsBeforeElement?: ReactNode;
126
+ /**
127
+ * The content of the card
128
+ */
129
+ children?: ReactNode;
130
+ /**
131
+ * The container elements rendered by the component
132
+ */
133
+ components?: {
134
+ Header?: ComponentType<any>;
135
+ Footer?: ComponentType<any>;
136
+ };
137
+ /**
138
+ * The heading to be rendered above the body
139
+ */
140
+ heading?: ReactNode;
141
+ /**
142
+ * An optional element rendered to the right of the heading
143
+ */
144
+ headingAfterElement?: ReactNode;
145
+ /**
146
+ * The image src to render above the heading
147
+ */
148
+ image?: string | ReactNode;
149
+ /**
150
+ * Removes elevation styles if set
151
+ */
152
+ isFlat?: boolean;
153
+ /**
154
+ * The theme of the card
155
+ */
156
+ theme?: ThemeProp<CardTokens, {}>;
157
+ /**
158
+ * Width of the card in pixels
159
+ */
160
+ width?: number;
161
+ innerRef?: Ref<HTMLElement> | null;
162
+ /**
163
+ * A `testId` prop is provided for specified elements,
164
+ * which is a unique string that appears as a data attribute `data-testid` in the rendered code,
165
+ * serving as a hook for automated tests.
166
+ */
167
+ testId?: string;
168
+ }
169
+
170
+ /**
171
+ * __Spotlight manager__
172
+ *
173
+ * Wraps usage of spotlight and manages progression through multiple spotlights.
174
+ *
175
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
176
+ */
177
+ export declare class SpotlightManager extends PureComponent<
178
+ SpotlightManagerProps,
179
+ {
180
+ spotlightCount: number;
181
+ targets: {
182
+ [key: string]: HTMLElement | void;
183
+ };
184
+ }
185
+ > {
186
+ static defaultProps: {
187
+ blanketIsTinted: boolean;
188
+ };
189
+ componentDidMount(): void;
190
+ state: {
191
+ spotlightCount: number;
192
+ targets: {};
193
+ };
194
+ targetRef: (name: string) => (element: HTMLElement | void) => void;
195
+ spotlightOpen: () => void;
196
+ spotlightClose: () => void;
197
+ getStateProviderValue: MemoizedFn<
198
+ (
199
+ this: any,
200
+ targets: any,
201
+ ) => {
202
+ opened: () => void;
203
+ closed: () => void;
204
+ targets: any;
205
+ }
206
+ >;
207
+ render(): JSX.Element;
208
+ }
209
+
210
+ declare interface SpotlightManagerProps {
211
+ /**
212
+ * Boolean prop for toggling blanket transparency
213
+ */
214
+ blanketIsTinted?: boolean;
215
+ /**
216
+ * Typically the app, or a section of the app
217
+ */
218
+ children: ReactNode;
219
+ /**
220
+ * @deprecated
221
+ * Replaces the wrapping fragment with component
222
+ */
223
+ component?: ElementType;
224
+ }
225
+
226
+ declare interface SpotlightProps {
227
+ /**
228
+ * Buttons to render in the footer
229
+ */
230
+ actions?: Actions;
231
+ /**
232
+ * An optional node to be rendered beside the footer actions
233
+ */
234
+ actionsBeforeElement?: ReactNode;
235
+ /**
236
+ * The elements rendered in the modal
237
+ */
238
+ children?: ReactNode;
239
+ /**
240
+ * Where the dialog should appear, relative to the contents of the children.
241
+ */
242
+ dialogPlacement?:
243
+ | 'top left'
244
+ | 'top center'
245
+ | 'top right'
246
+ | 'right top'
247
+ | 'right middle'
248
+ | 'right bottom'
249
+ | 'bottom left'
250
+ | 'bottom center'
251
+ | 'bottom right'
252
+ | 'left top'
253
+ | 'left middle'
254
+ | 'left bottom';
255
+ /**
256
+ * The width of the dialog in pixels. Min 160 - Max 600
257
+ */
258
+ dialogWidth?: number;
259
+ /**
260
+ * Optional element rendered below the body
261
+ */
262
+ footer?: ComponentType<any>;
263
+ /**
264
+ * Optional element rendered above the body
265
+ */
266
+ header?: ComponentType<any>;
267
+ /**
268
+ * Heading text rendered above the body
269
+ */
270
+ heading?: string;
271
+ /**
272
+ * An optional element rendered to the right of the heading
273
+ */
274
+ headingAfterElement?: ReactNode;
275
+ /**
276
+ * Path to the the your image
277
+ */
278
+ image?: string;
279
+ /**
280
+ * Whether or not to display a pulse animation around the spotlighted element
281
+ */
282
+ pulse?: boolean;
283
+ /**
284
+ * The name of the SpotlightTarget
285
+ */
286
+ target?: string;
287
+ /**
288
+ * The spotlight target node
289
+ */
290
+ targetNode?: HTMLElement;
291
+ /**
292
+ * The background color of the element being highlighted
293
+ */
294
+ targetBgColor?: string;
295
+ /**
296
+ * Function to fire when a user clicks on the cloned target
297
+ */
298
+ targetOnClick?: (eventData: {
299
+ event: MouseEvent_2<HTMLElement>;
300
+ target?: string;
301
+ }) => void;
302
+ /**
303
+ * The border-radius of the element being highlighted
304
+ */
305
+ targetRadius?: number;
306
+ /**
307
+ * Alternative element to render than the wrapped target
308
+ */
309
+ targetReplacement?: ComponentType<any>;
310
+ /**
311
+ This prop is a unique string that appears as an attribute `data-testid` in the rendered HTML output serving as a hook for automated tests.
312
+ As this component is composed of multiple components we use this `testId` as a prefix:
313
+
314
+ - `"${testId}--dialog"` to identify the spotlight dialog
315
+ - `"${testId}--target"` to identify the spotlight target clone
316
+
317
+ Defaults to `"spotlight"`.
318
+ */
319
+ testId?: string;
320
+ }
321
+
322
+ /**
323
+ * __Pulse__
324
+ *
325
+ * Allows consumers to apply the spotlight pulse effect in a custom way.
326
+ *
327
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
328
+ */
329
+ export declare const SpotlightPulse: React.FC<TargetProps>;
330
+
331
+ /**
332
+ * __Spotlight target__
333
+ *
334
+ * Wraps an element, allowing it to be targeted by a spotlight.
335
+ *
336
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
337
+ */
338
+ export declare const SpotlightTarget: React_2.FC<SpotlightTargetProps>;
339
+
340
+ declare interface SpotlightTargetProps {
341
+ /**
342
+ * A single child
343
+ */
344
+ children: ReactNode;
345
+ /**
346
+ * The name to reference from Spotlight
347
+ */
348
+ name: string;
349
+ }
350
+
351
+ /**
352
+ * __Spotlight transition__
353
+ *
354
+ * Provides context used for fading animations.
355
+ *
356
+ * - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
357
+ */
358
+ export declare class SpotlightTransition extends React_2.Component<
359
+ SpotlightTransitionProps,
360
+ State
361
+ > {
362
+ static getDerivedStateFromProps(
363
+ props: SpotlightTransitionProps,
364
+ state: State,
365
+ ): {
366
+ currentChildren: React_2.ReactNode;
367
+ };
368
+ state: {
369
+ currentChildren: undefined;
370
+ };
371
+ onExited: () => void;
372
+ render(): JSX.Element;
373
+ }
374
+
375
+ declare interface SpotlightTransitionProps {
376
+ /**
377
+ * Children that are conditionally rendered. The transition happens based
378
+ * on the existence or non-existence of children.
379
+ */
380
+ children?: ReactNode;
381
+ }
382
+
383
+ declare interface State {
384
+ currentChildren: ReactNode;
385
+ }
386
+
387
+ declare type TargetProps = Omit<BaseProps, 'css'> & {
388
+ pulse?: boolean;
389
+ testId?: string;
390
+ };
391
+
392
+ /**
393
+ * Enables advanced usage of spotlights.
394
+ *
395
+ * Provides the following methods:
396
+ * - `isTargetRendered`
397
+ *
398
+ * Checks if the given spotlight target is currently
399
+ * being rendered.
400
+ */
401
+ export declare function useSpotlight(): {
402
+ isTargetRendered: (target: string) => boolean;
403
+ };
404
+
405
+ export {};
406
+ ```
@@ -1,160 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
11
-
12
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
-
14
- var _react = _interopRequireDefault(require("react"));
15
-
16
- var _core = require("@emotion/core");
17
-
18
- var _customThemeButton = _interopRequireDefault(require("@atlaskit/button/custom-theme-button"));
19
-
20
- var _components = require("@atlaskit/theme/components");
21
-
22
- var _constants = require("@atlaskit/theme/constants");
23
-
24
- var _typography = require("@atlaskit/theme/typography");
25
-
26
- var _dialog = require("../styled/dialog");
27
-
28
- var _excluded = ["children", "theme"],
29
- _excluded2 = ["text", "key"];
30
- var gridSize = (0, _constants.gridSize)(); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
31
-
32
- var lightH600Styles = (0, _core.css)((0, _typography.h600)({
33
- theme: {
34
- mode: 'light'
35
- }
36
- })); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
37
-
38
- var darkH600Styles = (0, _core.css)((0, _typography.h600)({
39
- theme: {
40
- mode: 'dark'
41
- }
42
- }));
43
-
44
- var Container = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
45
- var children = _ref.children,
46
- theme = _ref.theme,
47
- props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
48
- return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
49
- (0, _core.jsx)("div", (0, _extends2.default)({
50
- css: theme,
51
- ref: ref
52
- }, props), children)
53
- );
54
- });
55
-
56
- var bodyStyles = (0, _core.css)({
57
- display: 'flex',
58
- padding: "".concat(gridSize * 2, "px ").concat(gridSize * 2.5, "px"),
59
- flexDirection: 'column'
60
- }); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
61
-
62
- var headingStyles = (0, _core.css)({
63
- color: 'inherit'
64
- });
65
- var defaultHeaderStyles = (0, _core.css)({
66
- display: 'flex',
67
- paddingBottom: "".concat(gridSize, "px"),
68
- alignItems: 'baseline',
69
- justifyContent: 'space-between'
70
- });
71
-
72
- var DefaultHeader = function DefaultHeader(_ref2) {
73
- var children = _ref2.children;
74
- return (0, _core.jsx)("div", {
75
- css: defaultHeaderStyles
76
- }, children);
77
- };
78
-
79
- var defaultFooterStyles = (0, _core.css)({
80
- display: 'flex',
81
- paddingTop: "".concat(gridSize, "px"),
82
- alignItems: 'center',
83
- justifyContent: 'space-between'
84
- });
85
-
86
- var DefaultFooter = function DefaultFooter(_ref3) {
87
- var children = _ref3.children;
88
- return (0, _core.jsx)("div", {
89
- css: defaultFooterStyles
90
- }, children);
91
- };
92
-
93
- var Theme = (0, _components.createTheme)(function () {
94
- return {
95
- container: {
96
- overflow: 'auto',
97
- borderRadius: "".concat((0, _constants.borderRadius)(), "px"),
98
- height: 'fit-content',
99
- zIndex: "".concat(_constants.layers.spotlight() + 1)
100
- }
101
- };
102
- });
103
- /**
104
- * __Card__
105
- *
106
- * A card base for the spotlight card. The external `SpotlightCard` wraps this component.
107
- *
108
- * @internal
109
- */
110
-
111
- var Card = /*#__PURE__*/_react.default.forwardRef(function (_ref4, ref) {
112
- var _ref4$actions = _ref4.actions,
113
- actions = _ref4$actions === void 0 ? [] : _ref4$actions,
114
- actionsBeforeElement = _ref4.actionsBeforeElement,
115
- children = _ref4.children,
116
- _ref4$components = _ref4.components,
117
- components = _ref4$components === void 0 ? {} : _ref4$components,
118
- image = _ref4.image,
119
- heading = _ref4.heading,
120
- headingAfterElement = _ref4.headingAfterElement,
121
- theme = _ref4.theme,
122
- testId = _ref4.testId;
123
- var _components$Header = components.Header,
124
- Header = _components$Header === void 0 ? DefaultHeader : _components$Header,
125
- _components$Footer = components.Footer,
126
- Footer = _components$Footer === void 0 ? DefaultFooter : _components$Footer;
127
-
128
- var _useGlobalTheme = (0, _components.useGlobalTheme)(),
129
- mode = _useGlobalTheme.mode;
130
-
131
- return (0, _core.jsx)(Theme.Provider, {
132
- value: theme
133
- }, (0, _core.jsx)(Theme.Consumer, null, function (_ref5) {
134
- var container = _ref5.container;
135
- return (// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
136
- (0, _core.jsx)(Container, {
137
- theme: container,
138
- ref: ref,
139
- "data-testid": testId
140
- }, typeof image === 'string' ? (0, _core.jsx)("img", {
141
- src: image,
142
- alt: ""
143
- }) : image, (0, _core.jsx)("div", {
144
- css: bodyStyles
145
- }, heading || headingAfterElement ? (0, _core.jsx)(Header, null, (0, _core.jsx)("h4", {
146
- css: [mode === 'light' ? lightH600Styles : darkH600Styles, headingStyles]
147
- }, heading), headingAfterElement) : null, children, actions.length > 0 || actionsBeforeElement ? (0, _core.jsx)(Footer, null, actionsBeforeElement || (0, _core.jsx)("span", null), (0, _core.jsx)(_dialog.DialogActionItemContainer, null, actions.map(function (_ref6, idx) {
148
- var text = _ref6.text,
149
- key = _ref6.key,
150
- rest = (0, _objectWithoutProperties2.default)(_ref6, _excluded2);
151
- return (0, _core.jsx)(_dialog.DialogActionItem, {
152
- key: key || (typeof text === 'string' ? text : "".concat(idx))
153
- }, (0, _core.jsx)(_customThemeButton.default, rest, text));
154
- }))) : null))
155
- );
156
- }));
157
- });
158
-
159
- var _default = Card;
160
- exports.default = _default;