@atlaskit/spotlight 0.0.8 → 0.0.10
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 +15 -0
- package/dist/cjs/controllers/context.js +64 -11
- package/dist/cjs/index.js +21 -1
- package/dist/cjs/ui/body/index.compiled.css +1 -0
- package/dist/cjs/ui/body/index.js +31 -0
- package/dist/cjs/ui/dismiss-control/index.js +7 -5
- package/dist/cjs/ui/footer/index.compiled.css +0 -1
- package/dist/cjs/ui/footer/index.js +1 -1
- package/dist/cjs/ui/header/index.compiled.css +0 -2
- package/dist/cjs/ui/header/index.js +1 -1
- package/dist/cjs/ui/headline/index.js +0 -1
- package/dist/cjs/ui/popover-content/index.compiled.css +4 -0
- package/dist/cjs/ui/popover-content/index.js +21 -11
- package/dist/cjs/ui/spotlight/index.compiled.css +5 -2
- package/dist/cjs/ui/spotlight/index.js +8 -5
- package/dist/es2019/controllers/context.js +55 -10
- package/dist/es2019/index.js +3 -1
- package/dist/es2019/ui/body/index.compiled.css +1 -0
- package/dist/es2019/ui/body/index.js +24 -0
- package/dist/es2019/ui/dismiss-control/index.js +6 -4
- package/dist/es2019/ui/footer/index.compiled.css +0 -1
- package/dist/es2019/ui/footer/index.js +1 -1
- package/dist/es2019/ui/header/index.compiled.css +0 -2
- package/dist/es2019/ui/header/index.js +1 -1
- package/dist/es2019/ui/headline/index.js +0 -1
- package/dist/es2019/ui/popover-content/index.compiled.css +4 -0
- package/dist/es2019/ui/popover-content/index.js +18 -8
- package/dist/es2019/ui/spotlight/index.compiled.css +5 -2
- package/dist/es2019/ui/spotlight/index.js +8 -5
- package/dist/esm/controllers/context.js +63 -10
- package/dist/esm/index.js +3 -1
- package/dist/esm/ui/body/index.compiled.css +1 -0
- package/dist/esm/ui/body/index.js +23 -0
- package/dist/esm/ui/dismiss-control/index.js +7 -5
- package/dist/esm/ui/footer/index.compiled.css +0 -1
- package/dist/esm/ui/footer/index.js +1 -1
- package/dist/esm/ui/header/index.compiled.css +0 -2
- package/dist/esm/ui/header/index.js +1 -1
- package/dist/esm/ui/headline/index.js +0 -1
- package/dist/esm/ui/popover-content/index.compiled.css +4 -0
- package/dist/esm/ui/popover-content/index.js +21 -11
- package/dist/esm/ui/spotlight/index.compiled.css +5 -2
- package/dist/esm/ui/spotlight/index.js +8 -5
- 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 +21 -0
- package/dist/types/ui/dismiss-control/index.d.ts +5 -0
- package/dist/types/ui/headline/index.d.ts +1 -1
- package/dist/types/ui/popover-content/index.d.ts +12 -5
- package/dist/types/ui/spotlight/caret/index.d.ts +0 -1
- 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 +21 -0
- package/dist/types-ts4.5/ui/dismiss-control/index.d.ts +5 -0
- package/dist/types-ts4.5/ui/headline/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/popover-content/index.d.ts +12 -5
- package/dist/types-ts4.5/ui/spotlight/caret/index.d.ts +0 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/spotlight
|
|
2
2
|
|
|
3
|
+
## 0.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#198989](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/198989)
|
|
8
|
+
[`c4a86f623352d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c4a86f623352d) -
|
|
9
|
+
Allow Spotlight to be dismissed. Implement basic Spotlight Tour functionality.
|
|
10
|
+
|
|
11
|
+
## 0.0.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`d972e69e6461e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d972e69e6461e) -
|
|
16
|
+
Create Body component. Rework spacing of Spotlight card. Minor refactoring.
|
|
17
|
+
|
|
3
18
|
## 0.0.8
|
|
4
19
|
|
|
5
20
|
### 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
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "SpotlightActions", {
|
|
|
33
33
|
return _actions.SpotlightActions;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "SpotlightBody", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _body.SpotlightBody;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "SpotlightControls", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function get() {
|
|
@@ -75,7 +81,20 @@ Object.defineProperty(exports, "SpotlightSecondaryAction", {
|
|
|
75
81
|
return _secondaryAction.SpotlightSecondaryAction;
|
|
76
82
|
}
|
|
77
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "TourContext", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function get() {
|
|
87
|
+
return _context.TourContext;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "TourContextProvider", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _context.TourContextProvider;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
78
96
|
var _spotlight = require("./ui/spotlight");
|
|
97
|
+
var _body = require("./ui/body");
|
|
79
98
|
var _header = require("./ui/header");
|
|
80
99
|
var _headline = require("./ui/headline");
|
|
81
100
|
var _footer = require("./ui/footer");
|
|
@@ -86,4 +105,5 @@ var _controls = require("./ui/controls");
|
|
|
86
105
|
var _dismissControl = require("./ui/dismiss-control");
|
|
87
106
|
var _popoverProvider = require("./ui/popover-provider");
|
|
88
107
|
var _popoverContent = require("./ui/popover-content");
|
|
89
|
-
var _popoverTarget = require("./ui/popover-target");
|
|
108
|
+
var _popoverTarget = require("./ui/popover-target");
|
|
109
|
+
var _context = require("./controllers/context");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
@@ -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.SpotlightBody = 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: "_18zrpxbi"
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* __SpotlightBody__
|
|
19
|
+
*
|
|
20
|
+
* `SpotlightBody` is required in a `Spotlight`. The content should be brief and direct to elaborate on the intent.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
var SpotlightBody = exports.SpotlightBody = /*#__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
|
+
});
|
|
@@ -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
|
});
|
|
@@ -12,7 +12,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
13
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
14
|
var styles = {
|
|
15
|
-
root: "_bozgpxbi _y4tiutpp
|
|
15
|
+
root: "_bozgpxbi _y4tiutpp _1bsb1osq"
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* __SpotlightFooter__
|
|
@@ -12,7 +12,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
13
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
14
|
var styles = {
|
|
15
|
-
root: "_bozgpxbi _y4tiutpp
|
|
15
|
+
root: "_bozgpxbi _y4tiutpp"
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* __SpotlightHeader__
|
|
@@ -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,23 +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;
|
|
39
|
-
|
|
40
|
-
|
|
49
|
+
var visibility = isVisible ? 'visible' : 'hidden';
|
|
50
|
+
(0, _react.useEffect)(function () {
|
|
51
|
+
setPlacement(placement);
|
|
52
|
+
}, [placement, setPlacement]);
|
|
53
|
+
return /*#__PURE__*/React.createElement(_popper.Popper, {
|
|
41
54
|
offset: [0, 0],
|
|
42
55
|
placement: popperPlacementMap[placement]
|
|
43
56
|
}, function (_ref2) {
|
|
44
57
|
var ref = _ref2.ref,
|
|
45
58
|
style = _ref2.style;
|
|
46
|
-
return (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
style: style
|
|
52
|
-
}, children)
|
|
53
|
-
);
|
|
59
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
60
|
+
ref: ref,
|
|
61
|
+
style: style,
|
|
62
|
+
className: (0, _runtime.ax)([styles[visibility]])
|
|
63
|
+
}, children);
|
|
54
64
|
});
|
|
55
65
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
2
|
+
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
3
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
3
5
|
._154iu2gc{top:var(--ds-space-100,8px)}
|
|
4
6
|
._1bsbaq3k{width:295px}
|
|
7
|
+
._1e0c1txw{display:flex}
|
|
5
8
|
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
6
9
|
._1ltvu2gc{left:var(--ds-space-100,8px)}
|
|
7
10
|
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
8
11
|
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
12
|
+
._2lx21bp4{flex-direction:column}
|
|
9
13
|
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
10
14
|
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
11
|
-
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
12
15
|
._kqswh2mm{position:relative}
|
|
13
16
|
._kqswstnw{position:absolute}
|
|
@@ -10,12 +10,14 @@ 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 _css = require("@atlaskit/css");
|
|
14
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
13
15
|
var _context = require("../../controllers/context");
|
|
14
16
|
var _caret = require("./caret");
|
|
15
17
|
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
18
|
var styles = {
|
|
17
19
|
root: "_kqswh2mm",
|
|
18
|
-
card: "_2rkopd34 _kqswstnw _1bsbaq3k
|
|
20
|
+
card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
19
21
|
};
|
|
20
22
|
var placementStyles = {
|
|
21
23
|
'top-start': "_94n5u2gc _1xi2mgjw",
|
|
@@ -39,10 +41,11 @@ var Spotlight = exports.Spotlight = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
39
41
|
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
|
|
40
42
|
placement = _useContext.placement;
|
|
41
43
|
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
-
className: (0, _runtime.ax)([styles.root])
|
|
43
|
-
}, /*#__PURE__*/React.createElement(_caret.Caret, null), /*#__PURE__*/React.createElement("div", {
|
|
44
|
-
ref: ref,
|
|
45
44
|
"data-testid": testId,
|
|
46
|
-
|
|
45
|
+
ref: ref,
|
|
46
|
+
className: (0, _runtime.ax)([styles.root])
|
|
47
|
+
}, /*#__PURE__*/React.createElement(_caret.Caret, null), /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
48
|
+
backgroundColor: "color.background.neutral.bold",
|
|
49
|
+
xcss: (0, _css.cx)(styles.card, placementStyles[placement])
|
|
47
50
|
}, children));
|
|
48
51
|
});
|
|
@@ -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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Spotlight } from './ui/spotlight';
|
|
2
|
+
export { SpotlightBody } from './ui/body';
|
|
2
3
|
export { SpotlightHeader } from './ui/header';
|
|
3
4
|
export { SpotlightHeadline } from './ui/headline';
|
|
4
5
|
export { SpotlightFooter } from './ui/footer';
|
|
@@ -9,4 +10,5 @@ export { SpotlightControls } from './ui/controls';
|
|
|
9
10
|
export { SpotlightDismissControl } from './ui/dismiss-control';
|
|
10
11
|
export { PopoverProvider } from './ui/popover-provider';
|
|
11
12
|
export { PopoverContent } from './ui/popover-content';
|
|
12
|
-
export { PopoverTarget } from './ui/popover-target';
|
|
13
|
+
export { PopoverTarget } from './ui/popover-target';
|
|
14
|
+
export { TourContext, TourContextProvider } from './controllers/context';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
@@ -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: "_18zrpxbi"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* __SpotlightBody__
|
|
11
|
+
*
|
|
12
|
+
* `SpotlightBody` is required in a `Spotlight`. The content should be brief and direct to elaborate on the intent.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export const SpotlightBody = /*#__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
|
+
});
|
|
@@ -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
|
});
|
|
@@ -4,7 +4,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
6
6
|
const styles = {
|
|
7
|
-
root: "_bozgpxbi _y4tiutpp
|
|
7
|
+
root: "_bozgpxbi _y4tiutpp _1bsb1osq"
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* __SpotlightFooter__
|
|
@@ -4,7 +4,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
6
6
|
const styles = {
|
|
7
|
-
root: "_bozgpxbi _y4tiutpp
|
|
7
|
+
root: "_bozgpxbi _y4tiutpp"
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* __SpotlightHeader__
|
|
@@ -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,23 +33,25 @@ 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);
|
|
33
|
-
|
|
42
|
+
const visibility = isVisible ? 'visible' : 'hidden';
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setPlacement(placement);
|
|
45
|
+
}, [placement, setPlacement]);
|
|
34
46
|
return /*#__PURE__*/React.createElement(Popper, {
|
|
35
47
|
offset: [0, 0],
|
|
36
48
|
placement: popperPlacementMap[placement]
|
|
37
49
|
}, ({
|
|
38
50
|
ref,
|
|
39
51
|
style
|
|
40
|
-
}) =>
|
|
41
|
-
/*#__PURE__*/
|
|
42
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
43
|
-
React.createElement("div", {
|
|
52
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
44
53
|
ref: ref,
|
|
45
|
-
style: style
|
|
54
|
+
style: style,
|
|
55
|
+
className: ax([styles[visibility]])
|
|
46
56
|
}, children));
|
|
47
57
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
2
|
+
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
3
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
3
5
|
._154iu2gc{top:var(--ds-space-100,8px)}
|
|
4
6
|
._1bsbaq3k{width:295px}
|
|
7
|
+
._1e0c1txw{display:flex}
|
|
5
8
|
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
6
9
|
._1ltvu2gc{left:var(--ds-space-100,8px)}
|
|
7
10
|
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
8
11
|
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
12
|
+
._2lx21bp4{flex-direction:column}
|
|
9
13
|
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
10
14
|
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
11
|
-
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
12
15
|
._kqswh2mm{position:relative}
|
|
13
16
|
._kqswstnw{position:absolute}
|
|
@@ -3,11 +3,13 @@ import "./index.compiled.css";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { forwardRef, useContext } from 'react';
|
|
6
|
+
import { cx } from '@atlaskit/css';
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
8
|
import { SpotlightContext } from '../../controllers/context';
|
|
7
9
|
import { Caret } from './caret';
|
|
8
10
|
const styles = {
|
|
9
11
|
root: "_kqswh2mm",
|
|
10
|
-
card: "_2rkopd34 _kqswstnw _1bsbaq3k
|
|
12
|
+
card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
11
13
|
};
|
|
12
14
|
const placementStyles = {
|
|
13
15
|
'top-start': "_94n5u2gc _1xi2mgjw",
|
|
@@ -33,10 +35,11 @@ export const Spotlight = /*#__PURE__*/forwardRef(({
|
|
|
33
35
|
placement
|
|
34
36
|
} = useContext(SpotlightContext);
|
|
35
37
|
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
className: ax([styles.root])
|
|
37
|
-
}, /*#__PURE__*/React.createElement(Caret, null), /*#__PURE__*/React.createElement("div", {
|
|
38
|
-
ref: ref,
|
|
39
38
|
"data-testid": testId,
|
|
40
|
-
|
|
39
|
+
ref: ref,
|
|
40
|
+
className: ax([styles.root])
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Caret, null), /*#__PURE__*/React.createElement(Box, {
|
|
42
|
+
backgroundColor: "color.background.neutral.bold",
|
|
43
|
+
xcss: cx(styles.card, placementStyles[placement])
|
|
41
44
|
}, children));
|
|
42
45
|
});
|
|
@@ -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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Spotlight } from './ui/spotlight';
|
|
2
|
+
export { SpotlightBody } from './ui/body';
|
|
2
3
|
export { SpotlightHeader } from './ui/header';
|
|
3
4
|
export { SpotlightHeadline } from './ui/headline';
|
|
4
5
|
export { SpotlightFooter } from './ui/footer';
|
|
@@ -9,4 +10,5 @@ export { SpotlightControls } from './ui/controls';
|
|
|
9
10
|
export { SpotlightDismissControl } from './ui/dismiss-control';
|
|
10
11
|
export { PopoverProvider } from './ui/popover-provider';
|
|
11
12
|
export { PopoverContent } from './ui/popover-content';
|
|
12
|
-
export { PopoverTarget } from './ui/popover-target';
|
|
13
|
+
export { PopoverTarget } from './ui/popover-target';
|
|
14
|
+
export { TourContext, TourContextProvider } from './controllers/context';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
@@ -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: "_18zrpxbi"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* __SpotlightBody__
|
|
11
|
+
*
|
|
12
|
+
* `SpotlightBody` is required in a `Spotlight`. The content should be brief and direct to elaborate on the intent.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export var SpotlightBody = /*#__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
|
+
});
|
|
@@ -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
|
});
|
|
@@ -4,7 +4,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
6
6
|
var styles = {
|
|
7
|
-
root: "_bozgpxbi _y4tiutpp
|
|
7
|
+
root: "_bozgpxbi _y4tiutpp _1bsb1osq"
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* __SpotlightFooter__
|
|
@@ -4,7 +4,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
4
4
|
import React, { forwardRef } from 'react';
|
|
5
5
|
import { Flex } from '@atlaskit/primitives/compiled';
|
|
6
6
|
var styles = {
|
|
7
|
-
root: "_bozgpxbi _y4tiutpp
|
|
7
|
+
root: "_bozgpxbi _y4tiutpp"
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
10
|
* __SpotlightHeader__
|
|
@@ -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,23 +33,25 @@ 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;
|
|
31
|
-
|
|
41
|
+
var visibility = isVisible ? 'visible' : 'hidden';
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
setPlacement(placement);
|
|
44
|
+
}, [placement, setPlacement]);
|
|
32
45
|
return /*#__PURE__*/React.createElement(Popper, {
|
|
33
46
|
offset: [0, 0],
|
|
34
47
|
placement: popperPlacementMap[placement]
|
|
35
48
|
}, function (_ref2) {
|
|
36
49
|
var ref = _ref2.ref,
|
|
37
50
|
style = _ref2.style;
|
|
38
|
-
return (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
style: style
|
|
44
|
-
}, children)
|
|
45
|
-
);
|
|
51
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
52
|
+
ref: ref,
|
|
53
|
+
style: style,
|
|
54
|
+
className: ax([styles[visibility]])
|
|
55
|
+
}, children);
|
|
46
56
|
});
|
|
47
57
|
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
2
|
+
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}
|
|
3
|
+
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
3
5
|
._154iu2gc{top:var(--ds-space-100,8px)}
|
|
4
6
|
._1bsbaq3k{width:295px}
|
|
7
|
+
._1e0c1txw{display:flex}
|
|
5
8
|
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
6
9
|
._1ltvu2gc{left:var(--ds-space-100,8px)}
|
|
7
10
|
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
8
11
|
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
12
|
+
._2lx21bp4{flex-direction:column}
|
|
9
13
|
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
10
14
|
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
11
|
-
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
12
15
|
._kqswh2mm{position:relative}
|
|
13
16
|
._kqswstnw{position:absolute}
|
|
@@ -3,11 +3,13 @@ import "./index.compiled.css";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { forwardRef, useContext } from 'react';
|
|
6
|
+
import { cx } from '@atlaskit/css';
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
8
|
import { SpotlightContext } from '../../controllers/context';
|
|
7
9
|
import { Caret } from './caret';
|
|
8
10
|
var styles = {
|
|
9
11
|
root: "_kqswh2mm",
|
|
10
|
-
card: "_2rkopd34 _kqswstnw _1bsbaq3k
|
|
12
|
+
card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
11
13
|
};
|
|
12
14
|
var placementStyles = {
|
|
13
15
|
'top-start': "_94n5u2gc _1xi2mgjw",
|
|
@@ -31,10 +33,11 @@ export var Spotlight = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
31
33
|
var _useContext = useContext(SpotlightContext),
|
|
32
34
|
placement = _useContext.placement;
|
|
33
35
|
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
-
className: ax([styles.root])
|
|
35
|
-
}, /*#__PURE__*/React.createElement(Caret, null), /*#__PURE__*/React.createElement("div", {
|
|
36
|
-
ref: ref,
|
|
37
36
|
"data-testid": testId,
|
|
38
|
-
|
|
37
|
+
ref: ref,
|
|
38
|
+
className: ax([styles.root])
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Caret, null), /*#__PURE__*/React.createElement(Box, {
|
|
40
|
+
backgroundColor: "color.background.neutral.bold",
|
|
41
|
+
xcss: cx(styles.card, placementStyles[placement])
|
|
39
42
|
}, children));
|
|
40
43
|
});
|
|
@@ -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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Spotlight, type SpotlightProps } from './ui/spotlight';
|
|
2
|
+
export { SpotlightBody, type SpotlightBodyProps } from './ui/body';
|
|
2
3
|
export { SpotlightHeader, type SpotlightHeaderProps } from './ui/header';
|
|
3
4
|
export { SpotlightHeadline, type SpotlightHeadlineProps } from './ui/headline';
|
|
4
5
|
export { SpotlightFooter, type SpotlightFooterProps } from './ui/footer';
|
|
@@ -10,3 +11,4 @@ export { SpotlightDismissControl, type SpotlightDismissControlProps } from './ui
|
|
|
10
11
|
export { PopoverProvider } from './ui/popover-provider';
|
|
11
12
|
export { PopoverContent } from './ui/popover-content';
|
|
12
13
|
export { PopoverTarget } from './ui/popover-target';
|
|
14
|
+
export { TourContext, TourContextProvider } from './controllers/context';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export interface SpotlightBodyProps {
|
|
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
|
+
* __SpotlightBody__
|
|
17
|
+
*
|
|
18
|
+
* `SpotlightBody` is required in a `Spotlight`. The content should be brief and direct to elaborate on the intent.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare const SpotlightBody: React.ForwardRefExoticComponent<SpotlightBodyProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
@@ -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__
|
|
@@ -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 {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Spotlight, type SpotlightProps } from './ui/spotlight';
|
|
2
|
+
export { SpotlightBody, type SpotlightBodyProps } from './ui/body';
|
|
2
3
|
export { SpotlightHeader, type SpotlightHeaderProps } from './ui/header';
|
|
3
4
|
export { SpotlightHeadline, type SpotlightHeadlineProps } from './ui/headline';
|
|
4
5
|
export { SpotlightFooter, type SpotlightFooterProps } from './ui/footer';
|
|
@@ -10,3 +11,4 @@ export { SpotlightDismissControl, type SpotlightDismissControlProps } from './ui
|
|
|
10
11
|
export { PopoverProvider } from './ui/popover-provider';
|
|
11
12
|
export { PopoverContent } from './ui/popover-content';
|
|
12
13
|
export { PopoverTarget } from './ui/popover-target';
|
|
14
|
+
export { TourContext, TourContextProvider } from './controllers/context';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export interface SpotlightBodyProps {
|
|
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
|
+
* __SpotlightBody__
|
|
17
|
+
*
|
|
18
|
+
* `SpotlightBody` is required in a `Spotlight`. The content should be brief and direct to elaborate on the intent.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare const SpotlightBody: React.ForwardRefExoticComponent<SpotlightBodyProps & React.RefAttributes<HTMLHeadingElement>>;
|
|
@@ -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__
|
|
@@ -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.10",
|
|
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",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/button": "^23.3.0",
|
|
33
33
|
"@atlaskit/css": "^0.12.0",
|
|
34
34
|
"@atlaskit/heading": "^5.2.0",
|
|
35
|
-
"@atlaskit/icon": "^27.
|
|
35
|
+
"@atlaskit/icon": "^27.11.0",
|
|
36
36
|
"@atlaskit/popper": "^7.1.0",
|
|
37
37
|
"@atlaskit/primitives": "^14.11.0",
|
|
38
38
|
"@atlaskit/tokens": "^6.0.0",
|