@atlaskit/onboarding 10.2.3 → 10.3.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 +32 -0
- package/dist/cjs/components/{Animation.js → animation.js} +8 -1
- package/dist/cjs/components/card.js +159 -0
- package/dist/cjs/components/{Clone.js → clone.js} +12 -3
- package/dist/cjs/components/index.js +13 -13
- package/dist/cjs/components/{Modal.js → modal.js} +22 -11
- package/dist/cjs/components/{SpotlightCard.js → spotlight-card.js} +15 -6
- package/dist/cjs/components/{SpotlightDialog.js → spotlight-dialog.js} +9 -8
- package/dist/cjs/components/{SpotlightInner.js → spotlight-inner.js} +16 -9
- package/dist/cjs/components/{SpotlightManager.js → spotlight-manager.js} +13 -5
- package/dist/cjs/components/spotlight-target.js +34 -0
- package/dist/cjs/components/{SpotlightTransition.js → spotlight-transition.js} +27 -11
- package/dist/cjs/components/spotlight.js +58 -0
- package/dist/cjs/components/theme.js +56 -180
- package/dist/cjs/components/{useSpotlight.js → use-spotlight.js} +11 -2
- package/dist/cjs/components/{ValueChanged.js → value-changed.js} +0 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/styled/blanket.js +66 -0
- package/dist/cjs/styled/dialog.js +86 -0
- package/dist/cjs/styled/modal.js +144 -0
- package/dist/cjs/styled/target.js +125 -0
- package/dist/cjs/utils/use-element-box.js +8 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/{Animation.js → animation.js} +9 -1
- package/dist/es2019/components/card.js +131 -0
- package/dist/es2019/components/{Clone.js → clone.js} +10 -1
- package/dist/es2019/components/index.js +7 -7
- package/dist/es2019/components/{Modal.js → modal.js} +23 -11
- package/dist/es2019/components/{SpotlightCard.js → spotlight-card.js} +13 -6
- package/dist/es2019/components/{SpotlightDialog.js → spotlight-dialog.js} +7 -6
- package/dist/es2019/components/{SpotlightInner.js → spotlight-inner.js} +12 -5
- package/dist/es2019/components/{SpotlightManager.js → spotlight-manager.js} +11 -3
- package/dist/es2019/components/spotlight-target.js +19 -0
- package/dist/es2019/components/{SpotlightTransition.js → spotlight-transition.js} +21 -5
- package/dist/es2019/components/spotlight.js +40 -0
- package/dist/es2019/components/theme.js +55 -180
- package/dist/es2019/components/{useSpotlight.js → use-spotlight.js} +11 -1
- package/dist/es2019/components/{ValueChanged.js → value-changed.js} +0 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/styled/blanket.js +46 -0
- package/dist/es2019/styled/dialog.js +62 -0
- package/dist/es2019/styled/modal.js +115 -0
- package/dist/es2019/styled/target.js +93 -0
- package/dist/es2019/utils/use-element-box.js +8 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/{Animation.js → animation.js} +9 -1
- package/dist/esm/components/card.js +140 -0
- package/dist/esm/components/{Clone.js → clone.js} +10 -1
- package/dist/esm/components/index.js +7 -7
- package/dist/esm/components/{Modal.js → modal.js} +22 -11
- package/dist/esm/components/{SpotlightCard.js → spotlight-card.js} +13 -5
- package/dist/esm/components/{SpotlightDialog.js → spotlight-dialog.js} +7 -6
- package/dist/esm/components/{SpotlightInner.js → spotlight-inner.js} +13 -6
- package/dist/esm/components/{SpotlightManager.js → spotlight-manager.js} +11 -3
- package/dist/esm/components/spotlight-target.js +22 -0
- package/dist/esm/components/{SpotlightTransition.js → spotlight-transition.js} +27 -11
- package/dist/esm/components/spotlight.js +45 -0
- package/dist/esm/components/theme.js +55 -180
- package/dist/esm/components/{useSpotlight.js → use-spotlight.js} +11 -1
- package/dist/esm/components/{ValueChanged.js → value-changed.js} +0 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/styled/blanket.js +52 -0
- package/dist/esm/styled/dialog.js +67 -0
- package/dist/esm/styled/modal.js +119 -0
- package/dist/esm/styled/target.js +107 -0
- package/dist/esm/utils/use-element-box.js +8 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/animation.d.ts +15 -0
- package/dist/types/components/{Card.d.ts → card.d.ts} +35 -12
- package/dist/types/components/clone.d.ts +50 -0
- package/dist/types/components/index.d.ts +7 -7
- package/dist/types/components/modal.d.ts +48 -0
- package/dist/types/components/spotlight-card.d.ts +63 -0
- package/dist/types/components/{SpotlightDialog.d.ts → spotlight-dialog.d.ts} +37 -13
- package/dist/types/components/spotlight-inner.d.ts +54 -0
- package/dist/types/components/{SpotlightManager.d.ts → spotlight-manager.d.ts} +21 -5
- package/dist/types/components/spotlight-target.d.ts +20 -0
- package/dist/types/components/spotlight-transition.d.ts +41 -0
- package/dist/types/components/spotlight.d.ts +96 -0
- package/dist/types/components/use-spotlight.d.ts +12 -0
- package/dist/types/components/value-changed.d.ts +11 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/styled/blanket.d.ts +18 -0
- package/dist/types/styled/dialog.d.ts +25 -0
- package/dist/types/styled/modal.d.ts +36 -0
- package/dist/types/styled/target.d.ts +35 -0
- package/dist/types/utils/use-element-box.d.ts +7 -0
- package/package.json +22 -11
- package/dist/cjs/components/Card.js +0 -103
- package/dist/cjs/components/Spotlight.js +0 -79
- package/dist/cjs/components/SpotlightTarget.js +0 -62
- package/dist/cjs/styled/Blanket.js +0 -35
- package/dist/cjs/styled/Dialog.js +0 -50
- package/dist/cjs/styled/Modal.js +0 -42
- package/dist/cjs/styled/Target.js +0 -54
- package/dist/es2019/components/Card.js +0 -87
- package/dist/es2019/components/Spotlight.js +0 -39
- package/dist/es2019/components/SpotlightTarget.js +0 -14
- package/dist/es2019/styled/Blanket.js +0 -23
- package/dist/es2019/styled/Dialog.js +0 -51
- package/dist/es2019/styled/Modal.js +0 -40
- package/dist/es2019/styled/Target.js +0 -40
- package/dist/esm/components/Card.js +0 -78
- package/dist/esm/components/Spotlight.js +0 -64
- package/dist/esm/components/SpotlightTarget.js +0 -42
- package/dist/esm/styled/Blanket.js +0 -20
- package/dist/esm/styled/Dialog.js +0 -18
- package/dist/esm/styled/Modal.js +0 -16
- package/dist/esm/styled/Target.js +0 -29
- package/dist/types/components/Animation.d.ts +0 -8
- package/dist/types/components/Clone.d.ts +0 -27
- package/dist/types/components/Modal.d.ts +0 -25
- package/dist/types/components/Spotlight.d.ts +0 -59
- package/dist/types/components/SpotlightCard.d.ts +0 -38
- package/dist/types/components/SpotlightInner.d.ts +0 -30
- package/dist/types/components/SpotlightTarget.d.ts +0 -11
- package/dist/types/components/SpotlightTransition.d.ts +0 -27
- package/dist/types/components/ValueChanged.d.ts +0 -11
- package/dist/types/components/useSpotlight.d.ts +0 -3
- package/dist/types/styled/Blanket.d.ts +0 -7
- package/dist/types/styled/Dialog.d.ts +0 -12
- package/dist/types/styled/Modal.d.ts +0 -10
- package/dist/types/styled/Target.d.ts +0 -16
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import { css, jsx, keyframes } from '@emotion/core';
|
|
5
|
+
import { P300 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { layers } from '@atlaskit/theme/constants';
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
8
|
+
// NOTE:
|
|
9
|
+
// Pulse color "rgb(101, 84, 192)" derived from "colors.P300"
|
|
10
|
+
const baseShadow = token('shadow.overlay', `0 0 0 2px ${P300}`);
|
|
11
|
+
const easing = 'cubic-bezier(0.55, 0.055, 0.675, 0.19)';
|
|
12
|
+
const pulseKeyframes = keyframes({
|
|
13
|
+
'0%, 33%': {
|
|
14
|
+
boxShadow: `${baseShadow}, 0 0 0 rgba(101, 84, 192, 1)`
|
|
15
|
+
},
|
|
16
|
+
'66%, 100%': {
|
|
17
|
+
boxShadow: `${baseShadow}, 0 0 0 10px rgba(101, 84, 192, 0.01)`
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const animationStyles = css({
|
|
21
|
+
animation: `${pulseKeyframes} 3000ms ${easing} infinite`
|
|
22
|
+
}); // IE11 and Edge: z-index needed because fixed position calculates z-index relative
|
|
23
|
+
// to body instead of nearest stacking context (Portal in our case).
|
|
24
|
+
|
|
25
|
+
const baseStyles = css({
|
|
26
|
+
zIndex: layers.spotlight() + 1
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const Base = ({
|
|
30
|
+
children,
|
|
31
|
+
bgColor,
|
|
32
|
+
radius,
|
|
33
|
+
style,
|
|
34
|
+
...props
|
|
35
|
+
}) => jsx("div", _extends({
|
|
36
|
+
css: baseStyles,
|
|
37
|
+
style: { ...style,
|
|
38
|
+
backgroundColor: bgColor,
|
|
39
|
+
borderRadius: radius ? `${radius}px` : undefined
|
|
40
|
+
}
|
|
41
|
+
}, props), children);
|
|
42
|
+
/**
|
|
43
|
+
* __Target inner__
|
|
44
|
+
*
|
|
45
|
+
* Used to apply spotlight border and pulse to spotlight targets.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export const TargetInner = ({
|
|
52
|
+
children,
|
|
53
|
+
pulse,
|
|
54
|
+
...props
|
|
55
|
+
}) => jsx(Base, _extends({}, props, {
|
|
56
|
+
css: [pulse && animationStyles]
|
|
57
|
+
}), children);
|
|
58
|
+
const targetOverlayStyles = css({
|
|
59
|
+
width: '100%',
|
|
60
|
+
height: '100%',
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
top: 0,
|
|
63
|
+
left: 0
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* __Target overlay__
|
|
67
|
+
*
|
|
68
|
+
* Overlays a spotlight target, allowing for custom click events that are intended
|
|
69
|
+
* only for onboarding.
|
|
70
|
+
*
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
export const TargetOverlay = props => jsx("div", _extends({}, props, {
|
|
75
|
+
css: targetOverlayStyles,
|
|
76
|
+
style: {
|
|
77
|
+
cursor: props.onClick ? 'pointer' : 'auto'
|
|
78
|
+
}
|
|
79
|
+
}));
|
|
80
|
+
/**
|
|
81
|
+
* __Pulse__
|
|
82
|
+
*
|
|
83
|
+
* Allows consumers to apply the spotlight pulse effect in a custom way.
|
|
84
|
+
*
|
|
85
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
export const Pulse = ({
|
|
89
|
+
children,
|
|
90
|
+
...props
|
|
91
|
+
}) => jsx(Base, _extends({}, props, {
|
|
92
|
+
css: animationStyles
|
|
93
|
+
}), children);
|
|
@@ -45,6 +45,14 @@ export const useElementBox = element => {
|
|
|
45
45
|
}, [element]);
|
|
46
46
|
return box;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* __Element box__
|
|
50
|
+
*
|
|
51
|
+
* Allows consumption of `userElementBox` hook through render props.
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
|
|
48
56
|
export const ElementBox = props => {
|
|
49
57
|
const box = useElementBox(props.element);
|
|
50
58
|
return props.children(box);
|
package/dist/es2019/version.json
CHANGED
|
@@ -10,8 +10,16 @@ var duration = {
|
|
|
10
10
|
enter: 0,
|
|
11
11
|
exit: 100
|
|
12
12
|
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* __Fade__
|
|
16
|
+
*
|
|
17
|
+
* A fade in animation used for spotlights.
|
|
18
|
+
*
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
13
21
|
export var Fade = function Fade(_ref) {
|
|
14
|
-
var hasEntered = _ref.
|
|
22
|
+
var hasEntered = _ref.hasEntered,
|
|
15
23
|
children = _ref.children,
|
|
16
24
|
onExited = _ref.onExited;
|
|
17
25
|
return /*#__PURE__*/React.createElement(Transition, {
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
|
|
4
|
+
/** @jsx jsx */
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { css, jsx } from '@emotion/core';
|
|
7
|
+
import Button from '@atlaskit/button/custom-theme-button';
|
|
8
|
+
import { createTheme, useGlobalTheme } from '@atlaskit/theme/components';
|
|
9
|
+
import { borderRadius, gridSize as getGridSize, layers } from '@atlaskit/theme/constants';
|
|
10
|
+
import { h600 } from '@atlaskit/theme/typography';
|
|
11
|
+
import { DialogActionItem, DialogActionItemContainer } from '../styled/dialog';
|
|
12
|
+
var gridSize = getGridSize(); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
13
|
+
|
|
14
|
+
var lightH600Styles = css(h600({
|
|
15
|
+
theme: {
|
|
16
|
+
mode: 'light'
|
|
17
|
+
}
|
|
18
|
+
})); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
19
|
+
|
|
20
|
+
var darkH600Styles = css(h600({
|
|
21
|
+
theme: {
|
|
22
|
+
mode: 'dark'
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
var Container = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
26
|
+
var children = _ref.children,
|
|
27
|
+
theme = _ref.theme,
|
|
28
|
+
props = _objectWithoutProperties(_ref, ["children", "theme"]);
|
|
29
|
+
|
|
30
|
+
return (// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
31
|
+
jsx("div", _extends({
|
|
32
|
+
css: theme,
|
|
33
|
+
ref: ref
|
|
34
|
+
}, props), children)
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
var bodyStyles = css({
|
|
38
|
+
display: 'flex',
|
|
39
|
+
padding: "".concat(gridSize * 2, "px ").concat(gridSize * 2.5, "px"),
|
|
40
|
+
flexDirection: 'column'
|
|
41
|
+
}); // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
42
|
+
|
|
43
|
+
var headingStyles = css({
|
|
44
|
+
color: 'inherit'
|
|
45
|
+
});
|
|
46
|
+
var defaultHeaderStyles = css({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
paddingBottom: "".concat(gridSize, "px"),
|
|
49
|
+
alignItems: 'baseline',
|
|
50
|
+
justifyContent: 'space-between'
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
var DefaultHeader = function DefaultHeader(_ref2) {
|
|
54
|
+
var children = _ref2.children;
|
|
55
|
+
return jsx("div", {
|
|
56
|
+
css: defaultHeaderStyles
|
|
57
|
+
}, children);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var defaultFooterStyles = css({
|
|
61
|
+
display: 'flex',
|
|
62
|
+
paddingTop: "".concat(gridSize, "px"),
|
|
63
|
+
alignItems: 'center',
|
|
64
|
+
justifyContent: 'space-between'
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
var DefaultFooter = function DefaultFooter(_ref3) {
|
|
68
|
+
var children = _ref3.children;
|
|
69
|
+
return jsx("div", {
|
|
70
|
+
css: defaultFooterStyles
|
|
71
|
+
}, children);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var Theme = createTheme(function () {
|
|
75
|
+
return {
|
|
76
|
+
container: {
|
|
77
|
+
overflow: 'auto',
|
|
78
|
+
borderRadius: "".concat(borderRadius(), "px"),
|
|
79
|
+
height: 'fit-content',
|
|
80
|
+
zIndex: "".concat(layers.spotlight() + 1)
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* __Card__
|
|
86
|
+
*
|
|
87
|
+
* A card base for the spotlight card. The external `SpotlightCard` wraps this component.
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
|
|
92
|
+
var Card = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
93
|
+
var _ref4$actions = _ref4.actions,
|
|
94
|
+
actions = _ref4$actions === void 0 ? [] : _ref4$actions,
|
|
95
|
+
actionsBeforeElement = _ref4.actionsBeforeElement,
|
|
96
|
+
children = _ref4.children,
|
|
97
|
+
_ref4$components = _ref4.components,
|
|
98
|
+
components = _ref4$components === void 0 ? {} : _ref4$components,
|
|
99
|
+
image = _ref4.image,
|
|
100
|
+
heading = _ref4.heading,
|
|
101
|
+
headingAfterElement = _ref4.headingAfterElement,
|
|
102
|
+
theme = _ref4.theme,
|
|
103
|
+
testId = _ref4.testId;
|
|
104
|
+
var _components$Header = components.Header,
|
|
105
|
+
Header = _components$Header === void 0 ? DefaultHeader : _components$Header,
|
|
106
|
+
_components$Footer = components.Footer,
|
|
107
|
+
Footer = _components$Footer === void 0 ? DefaultFooter : _components$Footer;
|
|
108
|
+
|
|
109
|
+
var _useGlobalTheme = useGlobalTheme(),
|
|
110
|
+
mode = _useGlobalTheme.mode;
|
|
111
|
+
|
|
112
|
+
return jsx(Theme.Provider, {
|
|
113
|
+
value: theme
|
|
114
|
+
}, jsx(Theme.Consumer, null, function (_ref5) {
|
|
115
|
+
var container = _ref5.container;
|
|
116
|
+
return (// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
117
|
+
jsx(Container, {
|
|
118
|
+
theme: container,
|
|
119
|
+
ref: ref,
|
|
120
|
+
"data-testid": testId
|
|
121
|
+
}, typeof image === 'string' ? jsx("img", {
|
|
122
|
+
src: image,
|
|
123
|
+
alt: ""
|
|
124
|
+
}) : image, jsx("div", {
|
|
125
|
+
css: bodyStyles
|
|
126
|
+
}, heading || headingAfterElement ? jsx(Header, null, jsx("h4", {
|
|
127
|
+
css: [mode === 'light' ? lightH600Styles : darkH600Styles, headingStyles]
|
|
128
|
+
}, heading), headingAfterElement) : null, children, actions.length > 0 || actionsBeforeElement ? jsx(Footer, null, actionsBeforeElement || jsx("span", null), jsx(DialogActionItemContainer, null, actions.map(function (_ref6, idx) {
|
|
129
|
+
var text = _ref6.text,
|
|
130
|
+
key = _ref6.key,
|
|
131
|
+
rest = _objectWithoutProperties(_ref6, ["text", "key"]);
|
|
132
|
+
|
|
133
|
+
return jsx(DialogActionItem, {
|
|
134
|
+
key: key || (typeof text === 'string' ? text : "".concat(idx))
|
|
135
|
+
}, jsx(Button, rest, text));
|
|
136
|
+
}))) : null))
|
|
137
|
+
);
|
|
138
|
+
}));
|
|
139
|
+
});
|
|
140
|
+
export default Card;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { TargetInner, TargetOverlay } from '../styled/
|
|
2
|
+
import { TargetInner, TargetOverlay } from '../styled/target';
|
|
3
3
|
|
|
4
4
|
function cloneAndOverrideStyles(node) {
|
|
5
5
|
var shouldCloneChildren = true;
|
|
@@ -11,6 +11,15 @@ function cloneAndOverrideStyles(node) {
|
|
|
11
11
|
clonedNode.style.transform = 'translate(0, 0) translate3d(0, 0, 0)';
|
|
12
12
|
return clonedNode;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* __Clone__
|
|
16
|
+
*
|
|
17
|
+
* Used for cloning spotlight targets. The clone is positioned on top of the spotlight target with
|
|
18
|
+
* a pulsing animation.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
|
|
14
23
|
|
|
15
24
|
var Clone = function Clone(props) {
|
|
16
25
|
var pulse = props.pulse,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import Modal from './
|
|
2
|
-
import Spotlight from './
|
|
3
|
-
import SpotlightCard from './
|
|
4
|
-
import SpotlightManager from './
|
|
5
|
-
import SpotlightTarget from './
|
|
6
|
-
import SpotlightTransition from './
|
|
7
|
-
import useSpotlight from './
|
|
1
|
+
import Modal from './modal';
|
|
2
|
+
import Spotlight from './spotlight';
|
|
3
|
+
import SpotlightCard from './spotlight-card';
|
|
4
|
+
import SpotlightManager from './spotlight-manager';
|
|
5
|
+
import SpotlightTarget from './spotlight-target';
|
|
6
|
+
import SpotlightTransition from './spotlight-transition';
|
|
7
|
+
import useSpotlight from './use-spotlight';
|
|
8
8
|
export { spotlightButtonTheme, modalButtonTheme } from './theme';
|
|
9
9
|
export { Modal, Spotlight, SpotlightCard, SpotlightManager, SpotlightTarget, SpotlightTransition, useSpotlight };
|
|
@@ -12,13 +12,24 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
12
12
|
|
|
13
13
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
/** @jsx jsx */
|
|
16
|
+
import { Component } from 'react';
|
|
17
|
+
import { jsx } from '@emotion/core';
|
|
16
18
|
import Button, { Theme as ButtonTheme } from '@atlaskit/button/custom-theme-button';
|
|
17
19
|
import Modal, { ModalBody } from '@atlaskit/modal-dialog';
|
|
18
|
-
import {
|
|
20
|
+
import { ModalBody as Body, ModalHeading as Heading, ModalActionContainer, ModalActionItem, ModalImage } from '../styled/modal';
|
|
19
21
|
import { modalButtonTheme } from './theme'; // TODO: DSP-1250 - use a composable API consistent with normal modal dialog
|
|
20
22
|
|
|
21
23
|
function noop() {}
|
|
24
|
+
/**
|
|
25
|
+
* __Onboarding modal__
|
|
26
|
+
*
|
|
27
|
+
* If the product change is large enough,
|
|
28
|
+
* this component can be used to outline the benefits of the change to the user.
|
|
29
|
+
*
|
|
30
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
|
|
31
|
+
*/
|
|
32
|
+
|
|
22
33
|
|
|
23
34
|
var OnboardingModal = /*#__PURE__*/function (_Component) {
|
|
24
35
|
_inherits(OnboardingModal, _Component);
|
|
@@ -41,9 +52,9 @@ var OnboardingModal = /*#__PURE__*/function (_Component) {
|
|
|
41
52
|
src = props.image;
|
|
42
53
|
|
|
43
54
|
var ImageElement = function ImageElement() {
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
return jsx(ModalImage, {
|
|
56
|
+
src: src,
|
|
57
|
+
alt: ""
|
|
47
58
|
});
|
|
48
59
|
};
|
|
49
60
|
|
|
@@ -57,9 +68,9 @@ var OnboardingModal = /*#__PURE__*/function (_Component) {
|
|
|
57
68
|
experimental_shouldShowPrimaryButtonOnRight = _props$experimental_s === void 0 ? false : _props$experimental_s;
|
|
58
69
|
|
|
59
70
|
var ActionsElement = function ActionsElement() {
|
|
60
|
-
return actionList ?
|
|
71
|
+
return actionList ? jsx(ButtonTheme.Provider, {
|
|
61
72
|
value: modalButtonTheme
|
|
62
|
-
},
|
|
73
|
+
}, jsx(ModalActionContainer, {
|
|
63
74
|
shouldReverseButtonOrder: experimental_shouldShowPrimaryButtonOnRight
|
|
64
75
|
}, actionList.map(function (_ref, idx) {
|
|
65
76
|
var text = _ref.text,
|
|
@@ -67,9 +78,9 @@ var OnboardingModal = /*#__PURE__*/function (_Component) {
|
|
|
67
78
|
rest = _objectWithoutProperties(_ref, ["text", "key"]);
|
|
68
79
|
|
|
69
80
|
var variant = idx ? 'subtle-link' : 'primary';
|
|
70
|
-
return
|
|
81
|
+
return jsx(ModalActionItem, {
|
|
71
82
|
key: key || (typeof text === 'string' ? text : "".concat(idx))
|
|
72
|
-
},
|
|
83
|
+
}, jsx(Button, _extends({
|
|
73
84
|
appearance: variant,
|
|
74
85
|
autoFocus: !idx
|
|
75
86
|
}, rest), text));
|
|
@@ -93,13 +104,13 @@ var OnboardingModal = /*#__PURE__*/function (_Component) {
|
|
|
93
104
|
|
|
94
105
|
var Header = this.headerComponent(this.props);
|
|
95
106
|
var Footer = this.footerComponent(this.props);
|
|
96
|
-
return
|
|
107
|
+
return jsx(Modal, _extends({
|
|
97
108
|
autoFocus: true,
|
|
98
109
|
onClose: noop,
|
|
99
110
|
shouldScrollInViewport: true,
|
|
100
111
|
shouldCloseOnOverlayClick: false,
|
|
101
112
|
shouldCloseOnEscapePress: false
|
|
102
|
-
}, props),
|
|
113
|
+
}, props), jsx(Header, null), jsx(ModalBody, null, jsx(Body, null, heading && jsx(Heading, null, heading), children)), jsx(Footer, null));
|
|
103
114
|
}
|
|
104
115
|
}]);
|
|
105
116
|
|
|
@@ -18,7 +18,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
18
18
|
import React from 'react';
|
|
19
19
|
import { Theme as ButtonTheme } from '@atlaskit/button/custom-theme-button';
|
|
20
20
|
import { N0, N50A, N60A, P300 } from '@atlaskit/theme/colors';
|
|
21
|
-
import
|
|
21
|
+
import { token } from '@atlaskit/tokens';
|
|
22
|
+
import Card from './card';
|
|
22
23
|
import { spotlightButtonTheme } from './theme';
|
|
23
24
|
|
|
24
25
|
var SpotlightCard = /*#__PURE__*/function (_React$Component) {
|
|
@@ -58,7 +59,8 @@ var SpotlightCard = /*#__PURE__*/function (_React$Component) {
|
|
|
58
59
|
actions: actions,
|
|
59
60
|
actionsBeforeElement: actionsBeforeElement,
|
|
60
61
|
components: components,
|
|
61
|
-
image: image
|
|
62
|
+
image: image // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
63
|
+
,
|
|
62
64
|
theme: function theme(parent) {
|
|
63
65
|
var _parent = parent({}),
|
|
64
66
|
container = _parent.container,
|
|
@@ -67,10 +69,10 @@ var SpotlightCard = /*#__PURE__*/function (_React$Component) {
|
|
|
67
69
|
return _theme(function () {
|
|
68
70
|
return _objectSpread(_objectSpread({}, others), {}, {
|
|
69
71
|
container: _objectSpread({
|
|
70
|
-
background: P300,
|
|
71
|
-
color: N0,
|
|
72
|
+
background: token('color.background.boldDiscovery.resting', P300),
|
|
73
|
+
color: token('color.text.onBold', N0),
|
|
72
74
|
width: "".concat(Math.min(Math.max(width, 160), 600), "px"),
|
|
73
|
-
boxShadow: isFlat ? undefined : "0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A)
|
|
75
|
+
boxShadow: isFlat ? undefined : token('shadow.card', "0 4px 8px -2px ".concat(N50A, ", 0 0 1px ").concat(N60A))
|
|
74
76
|
}, container)
|
|
75
77
|
});
|
|
76
78
|
}, {});
|
|
@@ -81,6 +83,12 @@ var SpotlightCard = /*#__PURE__*/function (_React$Component) {
|
|
|
81
83
|
|
|
82
84
|
return SpotlightCard;
|
|
83
85
|
}(React.Component);
|
|
86
|
+
/**
|
|
87
|
+
* __Spotlight card__
|
|
88
|
+
*
|
|
89
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
|
|
90
|
+
*/
|
|
91
|
+
|
|
84
92
|
|
|
85
93
|
_defineProperty(SpotlightCard, "defaultProps", {
|
|
86
94
|
width: 400,
|
|
@@ -19,11 +19,11 @@ import React, { Component } from 'react';
|
|
|
19
19
|
import FocusLock from 'react-focus-lock';
|
|
20
20
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
21
21
|
import { Popper } from '@atlaskit/popper';
|
|
22
|
-
import {
|
|
23
|
-
import SpotlightCard from './
|
|
24
|
-
import ValueChanged from './
|
|
22
|
+
import { DialogImage } from '../styled/dialog';
|
|
23
|
+
import SpotlightCard from './spotlight-card';
|
|
24
|
+
import ValueChanged from './value-changed';
|
|
25
25
|
var packageName = "@atlaskit/onboarding";
|
|
26
|
-
var packageVersion = "10.
|
|
26
|
+
var packageVersion = "10.3.0";
|
|
27
27
|
|
|
28
28
|
var SpotlightDialog = /*#__PURE__*/function (_Component) {
|
|
29
29
|
_inherits(SpotlightDialog, _Component);
|
|
@@ -127,7 +127,8 @@ var SpotlightDialog = /*#__PURE__*/function (_Component) {
|
|
|
127
127
|
autoFocus: true
|
|
128
128
|
}, /*#__PURE__*/React.createElement(SpotlightCard, {
|
|
129
129
|
ref: ref,
|
|
130
|
-
testId: testId
|
|
130
|
+
testId: testId // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
131
|
+
,
|
|
131
132
|
theme: function theme(parent) {
|
|
132
133
|
var _parent = parent({}),
|
|
133
134
|
container = _parent.container,
|
|
@@ -140,7 +141,7 @@ var SpotlightDialog = /*#__PURE__*/function (_Component) {
|
|
|
140
141
|
width: dialogWidth,
|
|
141
142
|
actions: actions,
|
|
142
143
|
actionsBeforeElement: actionsBeforeElement,
|
|
143
|
-
image: image && /*#__PURE__*/React.createElement(
|
|
144
|
+
image: image && /*#__PURE__*/React.createElement(DialogImage, {
|
|
144
145
|
alt: heading,
|
|
145
146
|
src: image
|
|
146
147
|
}),
|
|
@@ -23,11 +23,18 @@ import scrollIntoView from 'scroll-into-view-if-needed';
|
|
|
23
23
|
import Portal from '@atlaskit/portal';
|
|
24
24
|
import { layers } from '@atlaskit/theme/constants';
|
|
25
25
|
import { ElementBox } from '../utils/use-element-box';
|
|
26
|
-
import { Fade } from './
|
|
27
|
-
import Clone from './
|
|
28
|
-
import SpotlightDialog from './
|
|
29
|
-
import { SpotlightTransitionConsumer } from './
|
|
30
|
-
|
|
26
|
+
import { Fade } from './animation';
|
|
27
|
+
import Clone from './clone';
|
|
28
|
+
import SpotlightDialog from './spotlight-dialog';
|
|
29
|
+
import { SpotlightTransitionConsumer } from './spotlight-transition';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* __Spotlight inner__
|
|
33
|
+
*
|
|
34
|
+
* Renders the spotlight target clone and dialog.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
31
38
|
var SpotlightInner = /*#__PURE__*/function (_React$Component) {
|
|
32
39
|
_inherits(SpotlightInner, _React$Component);
|
|
33
40
|
|
|
@@ -133,7 +140,7 @@ var SpotlightInner = /*#__PURE__*/function (_React$Component) {
|
|
|
133
140
|
targetRadius: targetRadius
|
|
134
141
|
});
|
|
135
142
|
}), TargetReplacement && !replacementElement ? null : /*#__PURE__*/React.createElement(Fade, {
|
|
136
|
-
|
|
143
|
+
hasEntered: isOpen,
|
|
137
144
|
onExited: onExited
|
|
138
145
|
}, function (animationStyles) {
|
|
139
146
|
return /*#__PURE__*/React.createElement(SpotlightDialog, {
|
|
@@ -18,8 +18,8 @@ import React, { createContext, PureComponent } from 'react';
|
|
|
18
18
|
import memoizeOne from 'memoize-one';
|
|
19
19
|
import Portal from '@atlaskit/portal';
|
|
20
20
|
import { layers } from '@atlaskit/theme/constants';
|
|
21
|
-
import Blanket from '../styled/
|
|
22
|
-
import { Fade } from './
|
|
21
|
+
import Blanket from '../styled/blanket';
|
|
22
|
+
import { Fade } from './animation';
|
|
23
23
|
|
|
24
24
|
var noop = function noop() {};
|
|
25
25
|
|
|
@@ -42,6 +42,14 @@ var Container = function Container(_ref) {
|
|
|
42
42
|
children = _ref.children;
|
|
43
43
|
return /*#__PURE__*/React.createElement(Wrapper, null, children);
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* __Spotlight manager__
|
|
47
|
+
*
|
|
48
|
+
* Wraps usage of spotlight and manages progression through multiple spotlights.
|
|
49
|
+
*
|
|
50
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
|
|
51
|
+
*/
|
|
52
|
+
|
|
45
53
|
|
|
46
54
|
var SpotlightManager = /*#__PURE__*/function (_PureComponent) {
|
|
47
55
|
_inherits(SpotlightManager, _PureComponent);
|
|
@@ -125,7 +133,7 @@ var SpotlightManager = /*#__PURE__*/function (_PureComponent) {
|
|
|
125
133
|
}, /*#__PURE__*/React.createElement(Container, {
|
|
126
134
|
component: Tag || React.Fragment
|
|
127
135
|
}, /*#__PURE__*/React.createElement(Fade, {
|
|
128
|
-
|
|
136
|
+
hasEntered: this.state.spotlightCount > 0
|
|
129
137
|
}, function (animationStyles) {
|
|
130
138
|
return /*#__PURE__*/React.createElement(Portal, {
|
|
131
139
|
zIndex: layers.spotlight()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import NodeResolver from 'react-node-resolver';
|
|
3
|
+
import { TargetConsumer } from './spotlight-manager';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* __Spotlight target__
|
|
7
|
+
*
|
|
8
|
+
* Wraps an element, allowing it to be targeted by a spotlight.
|
|
9
|
+
*
|
|
10
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
|
|
11
|
+
*/
|
|
12
|
+
var SpotlightTarget = function SpotlightTarget(_ref) {
|
|
13
|
+
var children = _ref.children,
|
|
14
|
+
name = _ref.name;
|
|
15
|
+
return /*#__PURE__*/React.createElement(TargetConsumer, null, function (targetRef) {
|
|
16
|
+
return targetRef ? /*#__PURE__*/React.createElement(NodeResolver, {
|
|
17
|
+
innerRef: targetRef(name)
|
|
18
|
+
}, children) : children;
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default SpotlightTarget;
|
|
@@ -11,7 +11,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
|
|
13
13
|
import React, { createContext } from 'react';
|
|
14
|
-
var
|
|
14
|
+
var SpotlightTransitionContext = /*#__PURE__*/createContext({
|
|
15
15
|
isOpen: true,
|
|
16
16
|
onExited: function onExited() {}
|
|
17
17
|
}); // checks if children exist and are truthy
|
|
@@ -21,16 +21,24 @@ var hasChildren = function hasChildren(children) {
|
|
|
21
21
|
return !!child;
|
|
22
22
|
}).filter(Boolean).length > 0;
|
|
23
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* __Spotlight transition__
|
|
26
|
+
*
|
|
27
|
+
* Provides context used for fading animations.
|
|
28
|
+
*
|
|
29
|
+
* - [Examples](https://atlaskit.atlassian.com/packages/design-system/onboarding)
|
|
30
|
+
*/
|
|
24
31
|
|
|
25
|
-
var Transition = /*#__PURE__*/function (_React$Component) {
|
|
26
|
-
_inherits(Transition, _React$Component);
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
var SpotlightTransition = /*#__PURE__*/function (_React$Component) {
|
|
34
|
+
_inherits(SpotlightTransition, _React$Component);
|
|
29
35
|
|
|
30
|
-
|
|
36
|
+
var _super = _createSuper(SpotlightTransition);
|
|
37
|
+
|
|
38
|
+
function SpotlightTransition() {
|
|
31
39
|
var _this;
|
|
32
40
|
|
|
33
|
-
_classCallCheck(this,
|
|
41
|
+
_classCallCheck(this, SpotlightTransition);
|
|
34
42
|
|
|
35
43
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
44
|
args[_key] = arguments[_key];
|
|
@@ -51,10 +59,10 @@ var Transition = /*#__PURE__*/function (_React$Component) {
|
|
|
51
59
|
return _this;
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
_createClass(
|
|
62
|
+
_createClass(SpotlightTransition, [{
|
|
55
63
|
key: "render",
|
|
56
64
|
value: function render() {
|
|
57
|
-
return /*#__PURE__*/React.createElement(
|
|
65
|
+
return /*#__PURE__*/React.createElement(SpotlightTransitionContext.Provider, {
|
|
58
66
|
value: {
|
|
59
67
|
onExited: this.onExited,
|
|
60
68
|
isOpen: hasChildren(this.props.children)
|
|
@@ -72,8 +80,16 @@ var Transition = /*#__PURE__*/function (_React$Component) {
|
|
|
72
80
|
}
|
|
73
81
|
}]);
|
|
74
82
|
|
|
75
|
-
return
|
|
83
|
+
return SpotlightTransition;
|
|
76
84
|
}(React.Component);
|
|
85
|
+
/**
|
|
86
|
+
* __Spotlight transition consumer__
|
|
87
|
+
*
|
|
88
|
+
* Used to consume the spotlight transition context through render props.
|
|
89
|
+
*
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
|
|
77
93
|
|
|
78
|
-
export var SpotlightTransitionConsumer =
|
|
79
|
-
export default
|
|
94
|
+
export var SpotlightTransitionConsumer = SpotlightTransitionContext.Consumer;
|
|
95
|
+
export default SpotlightTransition;
|