@atlaskit/spotlight 0.0.9 → 0.0.11
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 +16 -0
- package/dist/cjs/controllers/context.js +64 -11
- package/dist/cjs/index.js +21 -1
- package/dist/cjs/ui/dismiss-control/index.js +7 -5
- package/dist/cjs/ui/media/index.compiled.css +2 -0
- package/dist/cjs/ui/media/index.js +31 -0
- package/dist/cjs/ui/popover-content/index.compiled.css +4 -0
- package/dist/cjs/ui/popover-content/index.js +18 -10
- package/dist/cjs/ui/spotlight/caret/index.compiled.css +6 -2
- package/dist/cjs/ui/spotlight/caret/index.js +13 -2
- package/dist/cjs/ui/spotlight/index.compiled.css +5 -5
- package/dist/cjs/ui/spotlight/index.js +8 -8
- package/dist/es2019/controllers/context.js +55 -10
- package/dist/es2019/index.js +3 -1
- package/dist/es2019/ui/dismiss-control/index.js +6 -4
- package/dist/es2019/ui/media/index.compiled.css +2 -0
- package/dist/es2019/ui/media/index.js +24 -0
- package/dist/es2019/ui/popover-content/index.compiled.css +4 -0
- package/dist/es2019/ui/popover-content/index.js +15 -7
- package/dist/es2019/ui/spotlight/caret/index.compiled.css +6 -2
- package/dist/es2019/ui/spotlight/caret/index.js +15 -3
- package/dist/es2019/ui/spotlight/index.compiled.css +5 -5
- package/dist/es2019/ui/spotlight/index.js +8 -8
- package/dist/esm/controllers/context.js +63 -10
- package/dist/esm/index.js +3 -1
- package/dist/esm/ui/dismiss-control/index.js +7 -5
- package/dist/esm/ui/media/index.compiled.css +2 -0
- package/dist/esm/ui/media/index.js +23 -0
- package/dist/esm/ui/popover-content/index.compiled.css +4 -0
- package/dist/esm/ui/popover-content/index.js +18 -10
- package/dist/esm/ui/spotlight/caret/index.compiled.css +6 -2
- package/dist/esm/ui/spotlight/caret/index.js +14 -3
- package/dist/esm/ui/spotlight/index.compiled.css +5 -5
- package/dist/esm/ui/spotlight/index.js +8 -8
- package/dist/types/controllers/context.d.ts +22 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/ui/body/index.d.ts +1 -1
- package/dist/types/ui/dismiss-control/index.d.ts +5 -0
- package/dist/types/ui/media/index.d.ts +21 -0
- package/dist/types/ui/popover-content/index.d.ts +12 -5
- package/dist/types-ts4.5/controllers/context.d.ts +22 -0
- package/dist/types-ts4.5/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/body/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/dismiss-control/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/media/index.d.ts +21 -0
- package/dist/types-ts4.5/ui/popover-content/index.d.ts +12 -5
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/spotlight
|
|
2
2
|
|
|
3
|
+
## 0.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#200012](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/200012)
|
|
8
|
+
[`fa829c42fc74f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fa829c42fc74f) -
|
|
9
|
+
Create SpotlightMedia component.
|
|
10
|
+
|
|
11
|
+
## 0.0.10
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#198989](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/198989)
|
|
16
|
+
[`c4a86f623352d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4a86f623352d) -
|
|
17
|
+
Allow Spotlight to be dismissed. Implement basic Spotlight Tour functionality.
|
|
18
|
+
|
|
3
19
|
## 0.0.9
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -5,7 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.SpotlightContextProvider = exports.SpotlightContext = void 0;
|
|
8
|
+
exports.TourContextProvider = exports.TourContext = exports.SpotlightContextProvider = exports.SpotlightContext = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
@@ -26,14 +26,67 @@ var SpotlightContextProvider = exports.SpotlightContextProvider = function Spotl
|
|
|
26
26
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
27
27
|
placement = _useState2[0],
|
|
28
28
|
setPlacement = _useState2[1];
|
|
29
|
-
return (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(SpotlightContext.Provider, {
|
|
30
|
+
value: {
|
|
31
|
+
placement: placement,
|
|
32
|
+
setPlacement: setPlacement
|
|
33
|
+
}
|
|
34
|
+
}, children);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* __Tour context__
|
|
41
|
+
*
|
|
42
|
+
* A tour context is a way of managing multiple spotlights as steps in the same tour.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
var TourContext = exports.TourContext = /*#__PURE__*/(0, _react.createContext)({
|
|
46
|
+
currentStep: 1,
|
|
47
|
+
setCurrentStep: function setCurrentStep() {
|
|
48
|
+
return undefined;
|
|
49
|
+
},
|
|
50
|
+
next: function next() {
|
|
51
|
+
return undefined;
|
|
52
|
+
},
|
|
53
|
+
prev: function prev() {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* __Tour context provider__
|
|
60
|
+
*
|
|
61
|
+
* A tour context provider is a way of managing multiple spotlights as steps in the same tour.
|
|
62
|
+
*
|
|
63
|
+
*/
|
|
64
|
+
var TourContextProvider = exports.TourContextProvider = function TourContextProvider(_ref2) {
|
|
65
|
+
var children = _ref2.children;
|
|
66
|
+
var _useState3 = (0, _react.useState)(1),
|
|
67
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
68
|
+
currentStep = _useState4[0],
|
|
69
|
+
setCurrentStep = _useState4[1];
|
|
70
|
+
var next = function next() {
|
|
71
|
+
if (!currentStep) {
|
|
72
|
+
setCurrentStep(1);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
setCurrentStep(currentStep + 1);
|
|
76
|
+
};
|
|
77
|
+
var prev = function prev() {
|
|
78
|
+
if (!currentStep) {
|
|
79
|
+
setCurrentStep(1);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
setCurrentStep(currentStep - 1);
|
|
83
|
+
};
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(TourContext.Provider, {
|
|
85
|
+
value: {
|
|
86
|
+
currentStep: currentStep,
|
|
87
|
+
setCurrentStep: setCurrentStep,
|
|
88
|
+
next: next,
|
|
89
|
+
prev: prev
|
|
90
|
+
}
|
|
91
|
+
}, children);
|
|
39
92
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -69,6 +69,12 @@ Object.defineProperty(exports, "SpotlightHeadline", {
|
|
|
69
69
|
return _headline.SpotlightHeadline;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
+
Object.defineProperty(exports, "SpotlightMedia", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function get() {
|
|
75
|
+
return _media.SpotlightMedia;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
72
78
|
Object.defineProperty(exports, "SpotlightPrimaryAction", {
|
|
73
79
|
enumerable: true,
|
|
74
80
|
get: function get() {
|
|
@@ -81,6 +87,18 @@ Object.defineProperty(exports, "SpotlightSecondaryAction", {
|
|
|
81
87
|
return _secondaryAction.SpotlightSecondaryAction;
|
|
82
88
|
}
|
|
83
89
|
});
|
|
90
|
+
Object.defineProperty(exports, "TourContext", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _context.TourContext;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "TourContextProvider", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function get() {
|
|
99
|
+
return _context.TourContextProvider;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
84
102
|
var _spotlight = require("./ui/spotlight");
|
|
85
103
|
var _body = require("./ui/body");
|
|
86
104
|
var _header = require("./ui/header");
|
|
@@ -91,6 +109,8 @@ var _primaryAction = require("./ui/primary-action");
|
|
|
91
109
|
var _secondaryAction = require("./ui/secondary-action");
|
|
92
110
|
var _controls = require("./ui/controls");
|
|
93
111
|
var _dismissControl = require("./ui/dismiss-control");
|
|
112
|
+
var _media = require("./ui/media");
|
|
94
113
|
var _popoverProvider = require("./ui/popover-provider");
|
|
95
114
|
var _popoverContent = require("./ui/popover-content");
|
|
96
|
-
var _popoverTarget = require("./ui/popover-target");
|
|
115
|
+
var _popoverTarget = require("./ui/popover-target");
|
|
116
|
+
var _context = require("./controllers/context");
|
|
@@ -17,13 +17,15 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
19
|
var SpotlightDismissControl = exports.SpotlightDismissControl = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
20
|
-
var
|
|
20
|
+
var onClick = _ref.onClick,
|
|
21
|
+
testId = _ref.testId;
|
|
21
22
|
return /*#__PURE__*/_react.default.createElement(_new.IconButton, {
|
|
22
|
-
testId: testId,
|
|
23
|
-
ref: ref,
|
|
24
23
|
appearance: "default",
|
|
25
|
-
spacing: "compact",
|
|
26
24
|
icon: _cross.default,
|
|
27
|
-
label: "Close"
|
|
25
|
+
label: "Close",
|
|
26
|
+
onClick: onClick,
|
|
27
|
+
ref: ref,
|
|
28
|
+
spacing: "compact",
|
|
29
|
+
testId: testId
|
|
28
30
|
});
|
|
29
31
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SpotlightMedia = void 0;
|
|
9
|
+
require("./index.compiled.css");
|
|
10
|
+
var _runtime = require("@compiled/react/runtime");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
|
+
var styles = {
|
|
15
|
+
root: "_1bsbaq3k _4t3ihcro"
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* __SpotlightMedia__
|
|
19
|
+
*
|
|
20
|
+
* `SpotlightMedia` is optional in a `Spotlight`.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
var SpotlightMedia = exports.SpotlightMedia = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
24
|
+
var children = _ref.children,
|
|
25
|
+
testId = _ref.testId;
|
|
26
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
27
|
+
ref: ref,
|
|
28
|
+
xcss: styles.root,
|
|
29
|
+
testId: testId
|
|
30
|
+
}, children);
|
|
31
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
1
2
|
"use strict";
|
|
2
3
|
|
|
3
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
@@ -5,10 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.PopoverContent = void 0;
|
|
9
|
+
require("./index.compiled.css");
|
|
8
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var React = _react;
|
|
12
|
+
var _runtime = require("@compiled/react/runtime");
|
|
9
13
|
var _popper = require("@atlaskit/popper");
|
|
10
14
|
var _context = require("../../controllers/context");
|
|
11
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
|
+
var styles = {
|
|
17
|
+
visible: "_lcxv1wug _3um0ewfl",
|
|
18
|
+
hidden: "_lcxvglyw _3um015vq"
|
|
19
|
+
};
|
|
12
20
|
/**
|
|
13
21
|
* The Spotlight card can be positioned in many different configurations, but the caret should always point to
|
|
14
22
|
* the center of the target element. `@atlaskit/popper` uses `'top' | 'right' | 'bottom' | 'left'` values for
|
|
@@ -33,25 +41,25 @@ var popperPlacementMap = {
|
|
|
33
41
|
*/
|
|
34
42
|
var PopoverContent = exports.PopoverContent = function PopoverContent(_ref) {
|
|
35
43
|
var children = _ref.children,
|
|
36
|
-
placement = _ref.placement
|
|
44
|
+
placement = _ref.placement,
|
|
45
|
+
_ref$isVisible = _ref.isVisible,
|
|
46
|
+
isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
|
|
37
47
|
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
|
|
38
48
|
setPlacement = _useContext.setPlacement;
|
|
49
|
+
var visibility = isVisible ? 'visible' : 'hidden';
|
|
39
50
|
(0, _react.useEffect)(function () {
|
|
40
51
|
setPlacement(placement);
|
|
41
52
|
}, [placement, setPlacement]);
|
|
42
|
-
return /*#__PURE__*/
|
|
53
|
+
return /*#__PURE__*/React.createElement(_popper.Popper, {
|
|
43
54
|
offset: [0, 0],
|
|
44
55
|
placement: popperPlacementMap[placement]
|
|
45
56
|
}, function (_ref2) {
|
|
46
57
|
var ref = _ref2.ref,
|
|
47
58
|
style = _ref2.style;
|
|
48
|
-
return (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
style: style
|
|
54
|
-
}, children)
|
|
55
|
-
);
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
ref: ref,
|
|
61
|
+
style: style,
|
|
62
|
+
className: (0, _runtime.ax)([styles[visibility]])
|
|
63
|
+
}, children);
|
|
56
64
|
});
|
|
57
65
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
1
|
+
._13lit94y{border-top-left-radius:1px}
|
|
2
|
+
._1bsbo7ao{width:15px}
|
|
3
|
+
._1o0zt94y{border-bottom-right-radius:1px}
|
|
4
|
+
._4t3io7ao{height:15px}
|
|
3
5
|
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
6
|
+
._mrkbt94y{border-bottom-left-radius:1px}
|
|
7
|
+
._qrwqt94y{border-top-right-radius:1px}
|
|
4
8
|
._t9ecjyd4{transform:rotate(45deg)}
|
|
@@ -10,9 +10,18 @@ require("./index.compiled.css");
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var React = _react;
|
|
12
12
|
var _runtime = require("@compiled/react/runtime");
|
|
13
|
+
var _context = require("../../../controllers/context");
|
|
13
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
15
|
var styles = {
|
|
15
|
-
root: "
|
|
16
|
+
root: "_1bsbo7ao _4t3io7ao _t9ecjyd4 _bfhkcdhy",
|
|
17
|
+
'top-start': "_1o0zt94y",
|
|
18
|
+
'top-end': "_1o0zt94y",
|
|
19
|
+
'bottom-start': "_13lit94y",
|
|
20
|
+
'bottom-end': "_13lit94y",
|
|
21
|
+
'right-start': "_mrkbt94y",
|
|
22
|
+
'right-end': "_mrkbt94y",
|
|
23
|
+
'left-start': "_qrwqt94y",
|
|
24
|
+
'left-end': "_qrwqt94y"
|
|
16
25
|
};
|
|
17
26
|
/**
|
|
18
27
|
* __Caret__
|
|
@@ -22,9 +31,11 @@ var styles = {
|
|
|
22
31
|
*/
|
|
23
32
|
var Caret = exports.Caret = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
24
33
|
var testId = _ref.testId;
|
|
34
|
+
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
|
|
35
|
+
placement = _useContext.placement;
|
|
25
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
37
|
"data-testid": testId,
|
|
27
38
|
ref: ref,
|
|
28
|
-
className: (0, _runtime.ax)([styles.root])
|
|
39
|
+
className: (0, _runtime.ax)([styles.root, styles[placement]])
|
|
29
40
|
});
|
|
30
41
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
3
3
|
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
|
-
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}.
|
|
5
|
-
.
|
|
4
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154i12x7{top:var(--ds-space-075,6px)}
|
|
5
|
+
._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
6
6
|
._1bsbaq3k{width:295px}
|
|
7
7
|
._1e0c1txw{display:flex}
|
|
8
|
+
._1ltv12x7{left:var(--ds-space-075,6px)}
|
|
8
9
|
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
9
|
-
.
|
|
10
|
+
._1xi212x7{right:var(--ds-space-075,6px)}
|
|
10
11
|
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
11
|
-
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
12
12
|
._2lx21bp4{flex-direction:column}
|
|
13
|
+
._94n512x7{bottom:var(--ds-space-075,6px)}
|
|
13
14
|
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
14
|
-
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
15
15
|
._kqswh2mm{position:relative}
|
|
16
16
|
._kqswstnw{position:absolute}
|
|
@@ -20,14 +20,14 @@ var styles = {
|
|
|
20
20
|
card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
21
21
|
};
|
|
22
22
|
var placementStyles = {
|
|
23
|
-
'top-start': "
|
|
24
|
-
'top-end': "
|
|
25
|
-
'right-start': "
|
|
26
|
-
'right-end': "
|
|
27
|
-
'bottom-start': "
|
|
28
|
-
'bottom-end': "
|
|
29
|
-
'left-start': "
|
|
30
|
-
'left-end': "
|
|
23
|
+
'top-start': "_94n512x7 _1xi2mgjw",
|
|
24
|
+
'top-end': "_94n512x7 _1ltvmgjw",
|
|
25
|
+
'right-start': "_1ltv12x7 _94n5mgjw",
|
|
26
|
+
'right-end': "_1ltv12x7 _154imgjw",
|
|
27
|
+
'bottom-start': "_154i12x7 _1xi2mgjw",
|
|
28
|
+
'bottom-end': "_154i12x7 _1ltvmgjw",
|
|
29
|
+
'left-start': "_1xi212x7 _94n5mgjw",
|
|
30
|
+
'left-end': "_1xi212x7 _154imgjw"
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
33
|
* __Spotlight__
|
|
@@ -13,14 +13,59 @@ export const SpotlightContextProvider = ({
|
|
|
13
13
|
children
|
|
14
14
|
}) => {
|
|
15
15
|
const [placement, setPlacement] = useState('bottom-end');
|
|
16
|
-
return (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
return /*#__PURE__*/React.createElement(SpotlightContext.Provider, {
|
|
17
|
+
value: {
|
|
18
|
+
placement,
|
|
19
|
+
setPlacement
|
|
20
|
+
}
|
|
21
|
+
}, children);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* __Tour context__
|
|
28
|
+
*
|
|
29
|
+
* A tour context is a way of managing multiple spotlights as steps in the same tour.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export const TourContext = /*#__PURE__*/createContext({
|
|
33
|
+
currentStep: 1,
|
|
34
|
+
setCurrentStep: () => undefined,
|
|
35
|
+
next: () => undefined,
|
|
36
|
+
prev: () => undefined
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* __Tour context provider__
|
|
41
|
+
*
|
|
42
|
+
* A tour context provider is a way of managing multiple spotlights as steps in the same tour.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
export const TourContextProvider = ({
|
|
46
|
+
children
|
|
47
|
+
}) => {
|
|
48
|
+
const [currentStep, setCurrentStep] = useState(1);
|
|
49
|
+
const next = () => {
|
|
50
|
+
if (!currentStep) {
|
|
51
|
+
setCurrentStep(1);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
setCurrentStep(currentStep + 1);
|
|
55
|
+
};
|
|
56
|
+
const prev = () => {
|
|
57
|
+
if (!currentStep) {
|
|
58
|
+
setCurrentStep(1);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setCurrentStep(currentStep - 1);
|
|
62
|
+
};
|
|
63
|
+
return /*#__PURE__*/React.createElement(TourContext.Provider, {
|
|
64
|
+
value: {
|
|
65
|
+
currentStep,
|
|
66
|
+
setCurrentStep,
|
|
67
|
+
next,
|
|
68
|
+
prev
|
|
69
|
+
}
|
|
70
|
+
}, children);
|
|
26
71
|
};
|
package/dist/es2019/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export { SpotlightPrimaryAction } from './ui/primary-action';
|
|
|
8
8
|
export { SpotlightSecondaryAction } from './ui/secondary-action';
|
|
9
9
|
export { SpotlightControls } from './ui/controls';
|
|
10
10
|
export { SpotlightDismissControl } from './ui/dismiss-control';
|
|
11
|
+
export { SpotlightMedia } from './ui/media';
|
|
11
12
|
export { PopoverProvider } from './ui/popover-provider';
|
|
12
13
|
export { PopoverContent } from './ui/popover-content';
|
|
13
|
-
export { PopoverTarget } from './ui/popover-target';
|
|
14
|
+
export { PopoverTarget } from './ui/popover-target';
|
|
15
|
+
export { TourContext, TourContextProvider } from './controllers/context';
|
|
@@ -8,14 +8,16 @@ import CrossIcon from '@atlaskit/icon/core/cross';
|
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
export const SpotlightDismissControl = /*#__PURE__*/forwardRef(({
|
|
11
|
+
onClick,
|
|
11
12
|
testId
|
|
12
13
|
}, ref) => {
|
|
13
14
|
return /*#__PURE__*/React.createElement(IconButton, {
|
|
14
|
-
testId: testId,
|
|
15
|
-
ref: ref,
|
|
16
15
|
appearance: "default",
|
|
17
|
-
spacing: "compact",
|
|
18
16
|
icon: CrossIcon,
|
|
19
|
-
label: "Close"
|
|
17
|
+
label: "Close",
|
|
18
|
+
onClick: onClick,
|
|
19
|
+
ref: ref,
|
|
20
|
+
spacing: "compact",
|
|
21
|
+
testId: testId
|
|
20
22
|
});
|
|
21
23
|
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
|
+
const styles = {
|
|
7
|
+
root: "_1bsbaq3k _4t3ihcro"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* __SpotlightMedia__
|
|
11
|
+
*
|
|
12
|
+
* `SpotlightMedia` is optional in a `Spotlight`.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export const SpotlightMedia = /*#__PURE__*/forwardRef(({
|
|
16
|
+
children,
|
|
17
|
+
testId
|
|
18
|
+
}, ref) => {
|
|
19
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
20
|
+
ref: ref,
|
|
21
|
+
xcss: styles.root,
|
|
22
|
+
testId: testId
|
|
23
|
+
}, children);
|
|
24
|
+
});
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useContext, useEffect } from 'react';
|
|
2
6
|
import { Popper } from '@atlaskit/popper';
|
|
3
7
|
import { SpotlightContext } from '../../controllers/context';
|
|
8
|
+
const styles = {
|
|
9
|
+
visible: "_lcxv1wug _3um0ewfl",
|
|
10
|
+
hidden: "_lcxvglyw _3um015vq"
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
13
|
* The Spotlight card can be positioned in many different configurations, but the caret should always point to
|
|
6
14
|
* the center of the target element. `@atlaskit/popper` uses `'top' | 'right' | 'bottom' | 'left'` values for
|
|
@@ -25,11 +33,13 @@ const popperPlacementMap = {
|
|
|
25
33
|
*/
|
|
26
34
|
export const PopoverContent = ({
|
|
27
35
|
children,
|
|
28
|
-
placement
|
|
36
|
+
placement,
|
|
37
|
+
isVisible = true
|
|
29
38
|
}) => {
|
|
30
39
|
const {
|
|
31
40
|
setPlacement
|
|
32
41
|
} = useContext(SpotlightContext);
|
|
42
|
+
const visibility = isVisible ? 'visible' : 'hidden';
|
|
33
43
|
useEffect(() => {
|
|
34
44
|
setPlacement(placement);
|
|
35
45
|
}, [placement, setPlacement]);
|
|
@@ -39,11 +49,9 @@ export const PopoverContent = ({
|
|
|
39
49
|
}, ({
|
|
40
50
|
ref,
|
|
41
51
|
style
|
|
42
|
-
}) =>
|
|
43
|
-
/*#__PURE__*/
|
|
44
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
45
|
-
React.createElement("div", {
|
|
52
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
46
53
|
ref: ref,
|
|
47
|
-
style: style
|
|
54
|
+
style: style,
|
|
55
|
+
className: ax([styles[visibility]])
|
|
48
56
|
}, children));
|
|
49
57
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
1
|
+
._13lit94y{border-top-left-radius:1px}
|
|
2
|
+
._1bsbo7ao{width:15px}
|
|
3
|
+
._1o0zt94y{border-bottom-right-radius:1px}
|
|
4
|
+
._4t3io7ao{height:15px}
|
|
3
5
|
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
6
|
+
._mrkbt94y{border-bottom-left-radius:1px}
|
|
7
|
+
._qrwqt94y{border-top-right-radius:1px}
|
|
4
8
|
._t9ecjyd4{transform:rotate(45deg)}
|
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
import "./index.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import { forwardRef, useContext } from 'react';
|
|
6
|
+
import { SpotlightContext } from '../../../controllers/context';
|
|
6
7
|
const styles = {
|
|
7
|
-
root: "
|
|
8
|
+
root: "_1bsbo7ao _4t3io7ao _t9ecjyd4 _bfhkcdhy",
|
|
9
|
+
'top-start': "_1o0zt94y",
|
|
10
|
+
'top-end': "_1o0zt94y",
|
|
11
|
+
'bottom-start': "_13lit94y",
|
|
12
|
+
'bottom-end': "_13lit94y",
|
|
13
|
+
'right-start': "_mrkbt94y",
|
|
14
|
+
'right-end': "_mrkbt94y",
|
|
15
|
+
'left-start': "_qrwqt94y",
|
|
16
|
+
'left-end': "_qrwqt94y"
|
|
8
17
|
};
|
|
9
18
|
/**
|
|
10
19
|
* __Caret__
|
|
@@ -15,9 +24,12 @@ const styles = {
|
|
|
15
24
|
export const Caret = /*#__PURE__*/forwardRef(({
|
|
16
25
|
testId
|
|
17
26
|
}, ref) => {
|
|
27
|
+
const {
|
|
28
|
+
placement
|
|
29
|
+
} = useContext(SpotlightContext);
|
|
18
30
|
return /*#__PURE__*/React.createElement("div", {
|
|
19
31
|
"data-testid": testId,
|
|
20
32
|
ref: ref,
|
|
21
|
-
className: ax([styles.root])
|
|
33
|
+
className: ax([styles.root, styles[placement]])
|
|
22
34
|
});
|
|
23
35
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
3
3
|
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
|
-
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}.
|
|
5
|
-
.
|
|
4
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154i12x7{top:var(--ds-space-075,6px)}
|
|
5
|
+
._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
6
6
|
._1bsbaq3k{width:295px}
|
|
7
7
|
._1e0c1txw{display:flex}
|
|
8
|
+
._1ltv12x7{left:var(--ds-space-075,6px)}
|
|
8
9
|
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
9
|
-
.
|
|
10
|
+
._1xi212x7{right:var(--ds-space-075,6px)}
|
|
10
11
|
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
11
|
-
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
12
12
|
._2lx21bp4{flex-direction:column}
|
|
13
|
+
._94n512x7{bottom:var(--ds-space-075,6px)}
|
|
13
14
|
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
14
|
-
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
15
15
|
._kqswh2mm{position:relative}
|
|
16
16
|
._kqswstnw{position:absolute}
|
|
@@ -12,14 +12,14 @@ const styles = {
|
|
|
12
12
|
card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
13
13
|
};
|
|
14
14
|
const placementStyles = {
|
|
15
|
-
'top-start': "
|
|
16
|
-
'top-end': "
|
|
17
|
-
'right-start': "
|
|
18
|
-
'right-end': "
|
|
19
|
-
'bottom-start': "
|
|
20
|
-
'bottom-end': "
|
|
21
|
-
'left-start': "
|
|
22
|
-
'left-end': "
|
|
15
|
+
'top-start': "_94n512x7 _1xi2mgjw",
|
|
16
|
+
'top-end': "_94n512x7 _1ltvmgjw",
|
|
17
|
+
'right-start': "_1ltv12x7 _94n5mgjw",
|
|
18
|
+
'right-end': "_1ltv12x7 _154imgjw",
|
|
19
|
+
'bottom-start': "_154i12x7 _1xi2mgjw",
|
|
20
|
+
'bottom-end': "_154i12x7 _1ltvmgjw",
|
|
21
|
+
'left-start': "_1xi212x7 _94n5mgjw",
|
|
22
|
+
'left-end': "_1xi212x7 _154imgjw"
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* __Spotlight__
|
|
@@ -18,14 +18,67 @@ export var SpotlightContextProvider = function SpotlightContextProvider(_ref) {
|
|
|
18
18
|
_useState2 = _slicedToArray(_useState, 2),
|
|
19
19
|
placement = _useState2[0],
|
|
20
20
|
setPlacement = _useState2[1];
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
return /*#__PURE__*/React.createElement(SpotlightContext.Provider, {
|
|
22
|
+
value: {
|
|
23
|
+
placement: placement,
|
|
24
|
+
setPlacement: setPlacement
|
|
25
|
+
}
|
|
26
|
+
}, children);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* __Tour context__
|
|
33
|
+
*
|
|
34
|
+
* A tour context is a way of managing multiple spotlights as steps in the same tour.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
export var TourContext = /*#__PURE__*/createContext({
|
|
38
|
+
currentStep: 1,
|
|
39
|
+
setCurrentStep: function setCurrentStep() {
|
|
40
|
+
return undefined;
|
|
41
|
+
},
|
|
42
|
+
next: function next() {
|
|
43
|
+
return undefined;
|
|
44
|
+
},
|
|
45
|
+
prev: function prev() {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* __Tour context provider__
|
|
52
|
+
*
|
|
53
|
+
* A tour context provider is a way of managing multiple spotlights as steps in the same tour.
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
export var TourContextProvider = function TourContextProvider(_ref2) {
|
|
57
|
+
var children = _ref2.children;
|
|
58
|
+
var _useState3 = useState(1),
|
|
59
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
60
|
+
currentStep = _useState4[0],
|
|
61
|
+
setCurrentStep = _useState4[1];
|
|
62
|
+
var next = function next() {
|
|
63
|
+
if (!currentStep) {
|
|
64
|
+
setCurrentStep(1);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
setCurrentStep(currentStep + 1);
|
|
68
|
+
};
|
|
69
|
+
var prev = function prev() {
|
|
70
|
+
if (!currentStep) {
|
|
71
|
+
setCurrentStep(1);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
setCurrentStep(currentStep - 1);
|
|
75
|
+
};
|
|
76
|
+
return /*#__PURE__*/React.createElement(TourContext.Provider, {
|
|
77
|
+
value: {
|
|
78
|
+
currentStep: currentStep,
|
|
79
|
+
setCurrentStep: setCurrentStep,
|
|
80
|
+
next: next,
|
|
81
|
+
prev: prev
|
|
82
|
+
}
|
|
83
|
+
}, children);
|
|
31
84
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export { SpotlightPrimaryAction } from './ui/primary-action';
|
|
|
8
8
|
export { SpotlightSecondaryAction } from './ui/secondary-action';
|
|
9
9
|
export { SpotlightControls } from './ui/controls';
|
|
10
10
|
export { SpotlightDismissControl } from './ui/dismiss-control';
|
|
11
|
+
export { SpotlightMedia } from './ui/media';
|
|
11
12
|
export { PopoverProvider } from './ui/popover-provider';
|
|
12
13
|
export { PopoverContent } from './ui/popover-content';
|
|
13
|
-
export { PopoverTarget } from './ui/popover-target';
|
|
14
|
+
export { PopoverTarget } from './ui/popover-target';
|
|
15
|
+
export { TourContext, TourContextProvider } from './controllers/context';
|
|
@@ -8,13 +8,15 @@ import CrossIcon from '@atlaskit/icon/core/cross';
|
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
export var SpotlightDismissControl = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
11
|
-
var
|
|
11
|
+
var onClick = _ref.onClick,
|
|
12
|
+
testId = _ref.testId;
|
|
12
13
|
return /*#__PURE__*/React.createElement(IconButton, {
|
|
13
|
-
testId: testId,
|
|
14
|
-
ref: ref,
|
|
15
14
|
appearance: "default",
|
|
16
|
-
spacing: "compact",
|
|
17
15
|
icon: CrossIcon,
|
|
18
|
-
label: "Close"
|
|
16
|
+
label: "Close",
|
|
17
|
+
onClick: onClick,
|
|
18
|
+
ref: ref,
|
|
19
|
+
spacing: "compact",
|
|
20
|
+
testId: testId
|
|
19
21
|
});
|
|
20
22
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { forwardRef } from 'react';
|
|
5
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
|
+
var styles = {
|
|
7
|
+
root: "_1bsbaq3k _4t3ihcro"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* __SpotlightMedia__
|
|
11
|
+
*
|
|
12
|
+
* `SpotlightMedia` is optional in a `Spotlight`.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export var SpotlightMedia = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
testId = _ref.testId;
|
|
18
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
19
|
+
ref: ref,
|
|
20
|
+
xcss: styles.root,
|
|
21
|
+
testId: testId
|
|
22
|
+
}, children);
|
|
23
|
+
});
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
+
import { useContext, useEffect } from 'react';
|
|
2
6
|
import { Popper } from '@atlaskit/popper';
|
|
3
7
|
import { SpotlightContext } from '../../controllers/context';
|
|
8
|
+
var styles = {
|
|
9
|
+
visible: "_lcxv1wug _3um0ewfl",
|
|
10
|
+
hidden: "_lcxvglyw _3um015vq"
|
|
11
|
+
};
|
|
4
12
|
/**
|
|
5
13
|
* The Spotlight card can be positioned in many different configurations, but the caret should always point to
|
|
6
14
|
* the center of the target element. `@atlaskit/popper` uses `'top' | 'right' | 'bottom' | 'left'` values for
|
|
@@ -25,9 +33,12 @@ var popperPlacementMap = {
|
|
|
25
33
|
*/
|
|
26
34
|
export var PopoverContent = function PopoverContent(_ref) {
|
|
27
35
|
var children = _ref.children,
|
|
28
|
-
placement = _ref.placement
|
|
36
|
+
placement = _ref.placement,
|
|
37
|
+
_ref$isVisible = _ref.isVisible,
|
|
38
|
+
isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
|
|
29
39
|
var _useContext = useContext(SpotlightContext),
|
|
30
40
|
setPlacement = _useContext.setPlacement;
|
|
41
|
+
var visibility = isVisible ? 'visible' : 'hidden';
|
|
31
42
|
useEffect(function () {
|
|
32
43
|
setPlacement(placement);
|
|
33
44
|
}, [placement, setPlacement]);
|
|
@@ -37,13 +48,10 @@ export var PopoverContent = function PopoverContent(_ref) {
|
|
|
37
48
|
}, function (_ref2) {
|
|
38
49
|
var ref = _ref2.ref,
|
|
39
50
|
style = _ref2.style;
|
|
40
|
-
return (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
style: style
|
|
46
|
-
}, children)
|
|
47
|
-
);
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
ref: ref,
|
|
53
|
+
style: style,
|
|
54
|
+
className: ax([styles[visibility]])
|
|
55
|
+
}, children);
|
|
48
56
|
});
|
|
49
57
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
.
|
|
2
|
-
.
|
|
1
|
+
._13lit94y{border-top-left-radius:1px}
|
|
2
|
+
._1bsbo7ao{width:15px}
|
|
3
|
+
._1o0zt94y{border-bottom-right-radius:1px}
|
|
4
|
+
._4t3io7ao{height:15px}
|
|
3
5
|
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
6
|
+
._mrkbt94y{border-bottom-left-radius:1px}
|
|
7
|
+
._qrwqt94y{border-top-right-radius:1px}
|
|
4
8
|
._t9ecjyd4{transform:rotate(45deg)}
|
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
import "./index.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { forwardRef } from 'react';
|
|
5
|
+
import { forwardRef, useContext } from 'react';
|
|
6
|
+
import { SpotlightContext } from '../../../controllers/context';
|
|
6
7
|
var styles = {
|
|
7
|
-
root: "
|
|
8
|
+
root: "_1bsbo7ao _4t3io7ao _t9ecjyd4 _bfhkcdhy",
|
|
9
|
+
'top-start': "_1o0zt94y",
|
|
10
|
+
'top-end': "_1o0zt94y",
|
|
11
|
+
'bottom-start': "_13lit94y",
|
|
12
|
+
'bottom-end': "_13lit94y",
|
|
13
|
+
'right-start': "_mrkbt94y",
|
|
14
|
+
'right-end': "_mrkbt94y",
|
|
15
|
+
'left-start': "_qrwqt94y",
|
|
16
|
+
'left-end': "_qrwqt94y"
|
|
8
17
|
};
|
|
9
18
|
/**
|
|
10
19
|
* __Caret__
|
|
@@ -14,9 +23,11 @@ var styles = {
|
|
|
14
23
|
*/
|
|
15
24
|
export var Caret = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
16
25
|
var testId = _ref.testId;
|
|
26
|
+
var _useContext = useContext(SpotlightContext),
|
|
27
|
+
placement = _useContext.placement;
|
|
17
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
18
29
|
"data-testid": testId,
|
|
19
30
|
ref: ref,
|
|
20
|
-
className: ax([styles.root])
|
|
31
|
+
className: ax([styles.root, styles[placement]])
|
|
21
32
|
});
|
|
22
33
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
3
3
|
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
|
-
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}.
|
|
5
|
-
.
|
|
4
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154i12x7{top:var(--ds-space-075,6px)}
|
|
5
|
+
._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
6
6
|
._1bsbaq3k{width:295px}
|
|
7
7
|
._1e0c1txw{display:flex}
|
|
8
|
+
._1ltv12x7{left:var(--ds-space-075,6px)}
|
|
8
9
|
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
9
|
-
.
|
|
10
|
+
._1xi212x7{right:var(--ds-space-075,6px)}
|
|
10
11
|
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
11
|
-
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
12
12
|
._2lx21bp4{flex-direction:column}
|
|
13
|
+
._94n512x7{bottom:var(--ds-space-075,6px)}
|
|
13
14
|
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
14
|
-
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
15
15
|
._kqswh2mm{position:relative}
|
|
16
16
|
._kqswstnw{position:absolute}
|
|
@@ -12,14 +12,14 @@ var styles = {
|
|
|
12
12
|
card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
13
13
|
};
|
|
14
14
|
var placementStyles = {
|
|
15
|
-
'top-start': "
|
|
16
|
-
'top-end': "
|
|
17
|
-
'right-start': "
|
|
18
|
-
'right-end': "
|
|
19
|
-
'bottom-start': "
|
|
20
|
-
'bottom-end': "
|
|
21
|
-
'left-start': "
|
|
22
|
-
'left-end': "
|
|
15
|
+
'top-start': "_94n512x7 _1xi2mgjw",
|
|
16
|
+
'top-end': "_94n512x7 _1ltvmgjw",
|
|
17
|
+
'right-start': "_1ltv12x7 _94n5mgjw",
|
|
18
|
+
'right-end': "_1ltv12x7 _154imgjw",
|
|
19
|
+
'bottom-start': "_154i12x7 _1xi2mgjw",
|
|
20
|
+
'bottom-end': "_154i12x7 _1ltvmgjw",
|
|
21
|
+
'left-start': "_1xi212x7 _94n5mgjw",
|
|
22
|
+
'left-end': "_1xi212x7 _154imgjw"
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
25
25
|
* __Spotlight__
|
|
@@ -8,4 +8,26 @@ export declare const SpotlightContext: React.Context<SpotlightContextType>;
|
|
|
8
8
|
export declare const SpotlightContextProvider: ({ children }: {
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
|
+
interface TourContextType {
|
|
12
|
+
currentStep: number | undefined;
|
|
13
|
+
setCurrentStep: Dispatch<SetStateAction<number | undefined>>;
|
|
14
|
+
next: () => void;
|
|
15
|
+
prev: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* __Tour context__
|
|
19
|
+
*
|
|
20
|
+
* A tour context is a way of managing multiple spotlights as steps in the same tour.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare const TourContext: React.Context<TourContextType>;
|
|
24
|
+
/**
|
|
25
|
+
* __Tour context provider__
|
|
26
|
+
*
|
|
27
|
+
* A tour context provider is a way of managing multiple spotlights as steps in the same tour.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export declare const TourContextProvider: ({ children }: {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
}) => React.JSX.Element;
|
|
11
33
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export { SpotlightPrimaryAction, type SpotlightPrimaryActionProps } from './ui/p
|
|
|
8
8
|
export { SpotlightSecondaryAction, type SpotlightSecondaryActionProps, } from './ui/secondary-action';
|
|
9
9
|
export { SpotlightControls, type SpotlightControlsProps } from './ui/controls';
|
|
10
10
|
export { SpotlightDismissControl, type SpotlightDismissControlProps } from './ui/dismiss-control';
|
|
11
|
+
export { SpotlightMedia, type SpotlightMediaProps } from './ui/media';
|
|
11
12
|
export { PopoverProvider } from './ui/popover-provider';
|
|
12
13
|
export { PopoverContent } from './ui/popover-content';
|
|
13
14
|
export { PopoverTarget } from './ui/popover-target';
|
|
15
|
+
export { TourContext, TourContextProvider } from './controllers/context';
|
|
@@ -18,4 +18,4 @@ export interface SpotlightBodyProps {
|
|
|
18
18
|
* `SpotlightBody` is required in a `Spotlight`. The content should be brief and direct to elaborate on the intent.
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
|
-
export declare const SpotlightBody: React.ForwardRefExoticComponent<SpotlightBodyProps & React.RefAttributes<
|
|
21
|
+
export declare const SpotlightBody: React.ForwardRefExoticComponent<SpotlightBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type IconButtonProps } from '@atlaskit/button/new';
|
|
2
3
|
export interface SpotlightDismissControlProps {
|
|
3
4
|
/**
|
|
4
5
|
* A `testId` prop is provided for specified elements, which is a unique
|
|
@@ -6,6 +7,10 @@ export interface SpotlightDismissControlProps {
|
|
|
6
7
|
* serving as a hook for automated tests
|
|
7
8
|
*/
|
|
8
9
|
testId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The action to take when the button is clicked.
|
|
12
|
+
*/
|
|
13
|
+
onClick?: IconButtonProps['onClick'];
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* __SpotlightDismissControl__
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export interface SpotlightMediaProps {
|
|
3
|
+
/**
|
|
4
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
5
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
6
|
+
* serving as a hook for automated tests
|
|
7
|
+
*/
|
|
8
|
+
testId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Textual content is required for all spotlights. It should be brief and direct
|
|
11
|
+
* to quickly elaborate on the intent.
|
|
12
|
+
*/
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* __SpotlightMedia__
|
|
17
|
+
*
|
|
18
|
+
* `SpotlightMedia` is optional in a `Spotlight`.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare const SpotlightMedia: React.ForwardRefExoticComponent<SpotlightMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
2
6
|
import type { Placement } from '../../types';
|
|
7
|
+
interface PopoverContentProps {
|
|
8
|
+
placement: Placement;
|
|
9
|
+
isVisible?: boolean;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* __PopoverContent__
|
|
5
14
|
*
|
|
6
15
|
* A `PopoverContent` is the element that is shown as a popover.
|
|
7
16
|
*/
|
|
8
|
-
export declare const PopoverContent: ({ children, placement }:
|
|
9
|
-
|
|
10
|
-
placement: Placement;
|
|
11
|
-
}) => React.JSX.Element;
|
|
17
|
+
export declare const PopoverContent: ({ children, placement, isVisible }: PopoverContentProps) => JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -8,4 +8,26 @@ export declare const SpotlightContext: React.Context<SpotlightContextType>;
|
|
|
8
8
|
export declare const SpotlightContextProvider: ({ children }: {
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
|
+
interface TourContextType {
|
|
12
|
+
currentStep: number | undefined;
|
|
13
|
+
setCurrentStep: Dispatch<SetStateAction<number | undefined>>;
|
|
14
|
+
next: () => void;
|
|
15
|
+
prev: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* __Tour context__
|
|
19
|
+
*
|
|
20
|
+
* A tour context is a way of managing multiple spotlights as steps in the same tour.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export declare const TourContext: React.Context<TourContextType>;
|
|
24
|
+
/**
|
|
25
|
+
* __Tour context provider__
|
|
26
|
+
*
|
|
27
|
+
* A tour context provider is a way of managing multiple spotlights as steps in the same tour.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
export declare const TourContextProvider: ({ children }: {
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
}) => React.JSX.Element;
|
|
11
33
|
export {};
|
|
@@ -8,6 +8,8 @@ export { SpotlightPrimaryAction, type SpotlightPrimaryActionProps } from './ui/p
|
|
|
8
8
|
export { SpotlightSecondaryAction, type SpotlightSecondaryActionProps, } from './ui/secondary-action';
|
|
9
9
|
export { SpotlightControls, type SpotlightControlsProps } from './ui/controls';
|
|
10
10
|
export { SpotlightDismissControl, type SpotlightDismissControlProps } from './ui/dismiss-control';
|
|
11
|
+
export { SpotlightMedia, type SpotlightMediaProps } from './ui/media';
|
|
11
12
|
export { PopoverProvider } from './ui/popover-provider';
|
|
12
13
|
export { PopoverContent } from './ui/popover-content';
|
|
13
14
|
export { PopoverTarget } from './ui/popover-target';
|
|
15
|
+
export { TourContext, TourContextProvider } from './controllers/context';
|
|
@@ -18,4 +18,4 @@ export interface SpotlightBodyProps {
|
|
|
18
18
|
* `SpotlightBody` is required in a `Spotlight`. The content should be brief and direct to elaborate on the intent.
|
|
19
19
|
*
|
|
20
20
|
*/
|
|
21
|
-
export declare const SpotlightBody: React.ForwardRefExoticComponent<SpotlightBodyProps & React.RefAttributes<
|
|
21
|
+
export declare const SpotlightBody: React.ForwardRefExoticComponent<SpotlightBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type IconButtonProps } from '@atlaskit/button/new';
|
|
2
3
|
export interface SpotlightDismissControlProps {
|
|
3
4
|
/**
|
|
4
5
|
* A `testId` prop is provided for specified elements, which is a unique
|
|
@@ -6,6 +7,10 @@ export interface SpotlightDismissControlProps {
|
|
|
6
7
|
* serving as a hook for automated tests
|
|
7
8
|
*/
|
|
8
9
|
testId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The action to take when the button is clicked.
|
|
12
|
+
*/
|
|
13
|
+
onClick?: IconButtonProps['onClick'];
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* __SpotlightDismissControl__
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export interface SpotlightMediaProps {
|
|
3
|
+
/**
|
|
4
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
5
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
6
|
+
* serving as a hook for automated tests
|
|
7
|
+
*/
|
|
8
|
+
testId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Textual content is required for all spotlights. It should be brief and direct
|
|
11
|
+
* to quickly elaborate on the intent.
|
|
12
|
+
*/
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* __SpotlightMedia__
|
|
17
|
+
*
|
|
18
|
+
* `SpotlightMedia` is optional in a `Spotlight`.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare const SpotlightMedia: React.ForwardRefExoticComponent<SpotlightMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
2
6
|
import type { Placement } from '../../types';
|
|
7
|
+
interface PopoverContentProps {
|
|
8
|
+
placement: Placement;
|
|
9
|
+
isVisible?: boolean;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
3
12
|
/**
|
|
4
13
|
* __PopoverContent__
|
|
5
14
|
*
|
|
6
15
|
* A `PopoverContent` is the element that is shown as a popover.
|
|
7
16
|
*/
|
|
8
|
-
export declare const PopoverContent: ({ children, placement }:
|
|
9
|
-
|
|
10
|
-
placement: Placement;
|
|
11
|
-
}) => React.JSX.Element;
|
|
17
|
+
export declare const PopoverContent: ({ children, placement, isVisible }: PopoverContentProps) => JSX.Element;
|
|
18
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/spotlight",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "A spotlight introduces users to various points of interest across Atlassian through focused messages or multi-step tours.",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@atlaskit/css": "^0.12.0",
|
|
34
34
|
"@atlaskit/heading": "^5.2.0",
|
|
35
35
|
"@atlaskit/icon": "^27.11.0",
|
|
36
|
+
"@atlaskit/image": "^3.0.0",
|
|
36
37
|
"@atlaskit/popper": "^7.1.0",
|
|
37
38
|
"@atlaskit/primitives": "^14.11.0",
|
|
38
39
|
"@atlaskit/tokens": "^6.0.0",
|