@atlaskit/spotlight 0.0.6 → 0.0.8
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 +18 -0
- package/dist/cjs/controllers/context.js +39 -0
- package/dist/cjs/index.js +22 -1
- package/dist/cjs/types.js +1 -0
- package/dist/cjs/ui/headline/index.js +1 -0
- package/dist/cjs/ui/popover-content/index.js +55 -0
- package/dist/cjs/ui/popover-provider/index.js +20 -0
- package/dist/cjs/ui/popover-target/index.js +23 -0
- package/dist/cjs/ui/spotlight/caret/index.compiled.css +4 -0
- package/dist/cjs/ui/spotlight/caret/index.js +30 -0
- package/dist/cjs/ui/spotlight/index.compiled.css +12 -2
- package/dist/cjs/ui/spotlight/index.js +22 -7
- package/dist/es2019/controllers/context.js +26 -0
- package/dist/es2019/index.js +4 -1
- package/dist/es2019/types.js +0 -0
- package/dist/es2019/ui/controls/index.js +2 -2
- package/dist/es2019/ui/dismiss-control/index.js +1 -1
- package/dist/es2019/ui/headline/index.js +1 -0
- package/dist/es2019/ui/popover-content/index.js +47 -0
- package/dist/es2019/ui/popover-provider/index.js +15 -0
- package/dist/es2019/ui/popover-target/index.js +17 -0
- package/dist/es2019/ui/spotlight/caret/index.compiled.css +4 -0
- package/dist/es2019/ui/spotlight/caret/index.js +23 -0
- package/dist/es2019/ui/spotlight/index.compiled.css +12 -2
- package/dist/es2019/ui/spotlight/index.js +24 -8
- package/dist/esm/controllers/context.js +31 -0
- package/dist/esm/index.js +4 -1
- package/dist/esm/types.js +0 -0
- package/dist/esm/ui/controls/index.js +2 -2
- package/dist/esm/ui/dismiss-control/index.js +1 -1
- package/dist/esm/ui/headline/index.js +1 -0
- package/dist/esm/ui/popover-content/index.js +47 -0
- package/dist/esm/ui/popover-provider/index.js +14 -0
- package/dist/esm/ui/popover-target/index.js +17 -0
- package/dist/esm/ui/spotlight/caret/index.compiled.css +4 -0
- package/dist/esm/ui/spotlight/caret/index.js +22 -0
- package/dist/esm/ui/spotlight/index.compiled.css +12 -2
- package/dist/esm/ui/spotlight/index.js +23 -8
- package/dist/types/controllers/context.d.ts +11 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/ui/controls/index.d.ts +1 -1
- package/dist/types/ui/dismiss-control/index.d.ts +1 -1
- package/dist/types/ui/popover-content/index.d.ts +11 -0
- package/dist/types/ui/popover-provider/index.d.ts +10 -0
- package/dist/types/ui/popover-target/index.d.ts +9 -0
- package/dist/types/ui/spotlight/caret/index.d.ts +20 -0
- package/dist/types-ts4.5/controllers/context.d.ts +11 -0
- package/dist/types-ts4.5/index.d.ts +4 -1
- package/dist/types-ts4.5/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/controls/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/dismiss-control/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/popover-content/index.d.ts +11 -0
- package/dist/types-ts4.5/ui/popover-provider/index.d.ts +10 -0
- package/dist/types-ts4.5/ui/popover-target/index.d.ts +9 -0
- package/dist/types-ts4.5/ui/spotlight/caret/index.d.ts +20 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/spotlight
|
|
2
2
|
|
|
3
|
+
## 0.0.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9d9570259070a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9d9570259070a) -
|
|
8
|
+
Create PopoverProvider, PopoverTarget, PopoverContent components.
|
|
9
|
+
- [`9d9570259070a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9d9570259070a) -
|
|
10
|
+
Create Caret component. Positions the Spotlight UI card in relation to the Caret component, and
|
|
11
|
+
positions the Caret component in relation to the PopoverTarget element.
|
|
12
|
+
|
|
13
|
+
## 0.0.7
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#197821](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/197821)
|
|
18
|
+
[`f9dbe2c16f7e0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f9dbe2c16f7e0) -
|
|
19
|
+
Create PopoverProvider, PopoverTarget, PopoverContent components.
|
|
20
|
+
|
|
3
21
|
## 0.0.6
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.SpotlightContextProvider = exports.SpotlightContext = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
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); }
|
|
12
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
15
|
+
var SpotlightContext = exports.SpotlightContext = /*#__PURE__*/(0, _react.createContext)({
|
|
16
|
+
placement: 'bottom-end',
|
|
17
|
+
setPlacement: function setPlacement() {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
23
|
+
var SpotlightContextProvider = exports.SpotlightContextProvider = function SpotlightContextProvider(_ref) {
|
|
24
|
+
var children = _ref.children;
|
|
25
|
+
var _useState = (0, _react.useState)('bottom-end'),
|
|
26
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
27
|
+
placement = _useState2[0],
|
|
28
|
+
setPlacement = _useState2[1];
|
|
29
|
+
return (
|
|
30
|
+
/*#__PURE__*/
|
|
31
|
+
// eslint-disable-next-line react/react-in-jsx-scope
|
|
32
|
+
_react.default.createElement(SpotlightContext.Provider, {
|
|
33
|
+
value: {
|
|
34
|
+
placement: placement,
|
|
35
|
+
setPlacement: setPlacement
|
|
36
|
+
}
|
|
37
|
+
}, children)
|
|
38
|
+
);
|
|
39
|
+
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "PopoverContent", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _popoverContent.PopoverContent;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "PopoverProvider", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _popoverProvider.PopoverProvider;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "PopoverTarget", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _popoverTarget.PopoverTarget;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
6
24
|
Object.defineProperty(exports, "Spotlight", {
|
|
7
25
|
enumerable: true,
|
|
8
26
|
get: function get() {
|
|
@@ -65,4 +83,7 @@ var _actions = require("./ui/actions");
|
|
|
65
83
|
var _primaryAction = require("./ui/primary-action");
|
|
66
84
|
var _secondaryAction = require("./ui/secondary-action");
|
|
67
85
|
var _controls = require("./ui/controls");
|
|
68
|
-
var _dismissControl = require("./ui/dismiss-control");
|
|
86
|
+
var _dismissControl = require("./ui/dismiss-control");
|
|
87
|
+
var _popoverProvider = require("./ui/popover-provider");
|
|
88
|
+
var _popoverContent = require("./ui/popover-content");
|
|
89
|
+
var _popoverTarget = require("./ui/popover-target");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PopoverContent = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _popper = require("@atlaskit/popper");
|
|
10
|
+
var _context = require("../../controllers/context");
|
|
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); }
|
|
12
|
+
/**
|
|
13
|
+
* The Spotlight card can be positioned in many different configurations, but the caret should always point to
|
|
14
|
+
* the center of the target element. `@atlaskit/popper` uses `'top' | 'right' | 'bottom' | 'left'` values for
|
|
15
|
+
* this center alignment along the respective face. So we translate between the Spotlight position, and the
|
|
16
|
+
* Popper position using this map.
|
|
17
|
+
*/
|
|
18
|
+
var popperPlacementMap = {
|
|
19
|
+
'top-start': 'top',
|
|
20
|
+
'top-end': 'top',
|
|
21
|
+
'bottom-start': 'bottom',
|
|
22
|
+
'bottom-end': 'bottom',
|
|
23
|
+
'right-start': 'right',
|
|
24
|
+
'right-end': 'right',
|
|
25
|
+
'left-start': 'left',
|
|
26
|
+
'left-end': 'left'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* __PopoverContent__
|
|
31
|
+
*
|
|
32
|
+
* A `PopoverContent` is the element that is shown as a popover.
|
|
33
|
+
*/
|
|
34
|
+
var PopoverContent = exports.PopoverContent = function PopoverContent(_ref) {
|
|
35
|
+
var children = _ref.children,
|
|
36
|
+
placement = _ref.placement;
|
|
37
|
+
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
|
|
38
|
+
setPlacement = _useContext.setPlacement;
|
|
39
|
+
setPlacement(placement);
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_popper.Popper, {
|
|
41
|
+
offset: [0, 0],
|
|
42
|
+
placement: popperPlacementMap[placement]
|
|
43
|
+
}, function (_ref2) {
|
|
44
|
+
var ref = _ref2.ref,
|
|
45
|
+
style = _ref2.style;
|
|
46
|
+
return (
|
|
47
|
+
/*#__PURE__*/
|
|
48
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
49
|
+
_react.default.createElement("div", {
|
|
50
|
+
ref: ref,
|
|
51
|
+
style: style
|
|
52
|
+
}, children)
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PopoverProvider = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _popper = require("@atlaskit/popper");
|
|
10
|
+
var _context = require("../../controllers/context");
|
|
11
|
+
/**
|
|
12
|
+
* __Popover provider__
|
|
13
|
+
*
|
|
14
|
+
* A popover provider provides necesary context for the `PopoverContent` and `PopoverTarget` components.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
var PopoverProvider = exports.PopoverProvider = function PopoverProvider(_ref) {
|
|
18
|
+
var children = _ref.children;
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_context.SpotlightContextProvider, null, /*#__PURE__*/_react.default.createElement(_popper.Manager, null, children));
|
|
20
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.PopoverTarget = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _popper = require("@atlaskit/popper");
|
|
10
|
+
/**
|
|
11
|
+
* __Target__
|
|
12
|
+
*
|
|
13
|
+
* A target is the element that the popover content will be positioned in relation to.
|
|
14
|
+
*/
|
|
15
|
+
var PopoverTarget = exports.PopoverTarget = function PopoverTarget(_ref) {
|
|
16
|
+
var children = _ref.children;
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_popper.Reference, null, function (_ref2) {
|
|
18
|
+
var ref = _ref2.ref;
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
ref: ref
|
|
21
|
+
}, children);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
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.Caret = void 0;
|
|
9
|
+
require("./index.compiled.css");
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var React = _react;
|
|
12
|
+
var _runtime = require("@compiled/react/runtime");
|
|
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: "_1bsb7vkz _4t3i7vkz _t9ecjyd4 _bfhkcdhy"
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* __Caret__
|
|
19
|
+
*
|
|
20
|
+
* A `Caret` is a purely visual pointer displayed on the edge of a spotlight, which points to the target element.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
var Caret = exports.Caret = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
24
|
+
var testId = _ref.testId;
|
|
25
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
"data-testid": testId,
|
|
27
|
+
ref: ref,
|
|
28
|
+
className: (0, _runtime.ax)([styles.root])
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}.
|
|
3
|
-
.
|
|
2
|
+
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
3
|
+
._154iu2gc{top:var(--ds-space-100,8px)}
|
|
4
|
+
._1bsbaq3k{width:295px}
|
|
5
|
+
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
6
|
+
._1ltvu2gc{left:var(--ds-space-100,8px)}
|
|
7
|
+
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
8
|
+
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
9
|
+
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
10
|
+
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
11
|
+
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
12
|
+
._kqswh2mm{position:relative}
|
|
13
|
+
._kqswstnw{position:absolute}
|
|
@@ -10,10 +10,22 @@ 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
|
|
13
|
+
var _context = require("../../controllers/context");
|
|
14
|
+
var _caret = require("./caret");
|
|
14
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); }
|
|
15
16
|
var styles = {
|
|
16
|
-
root: "
|
|
17
|
+
root: "_kqswh2mm",
|
|
18
|
+
card: "_2rkopd34 _kqswstnw _1bsbaq3k _bfhkcdhy"
|
|
19
|
+
};
|
|
20
|
+
var placementStyles = {
|
|
21
|
+
'top-start': "_94n5u2gc _1xi2mgjw",
|
|
22
|
+
'top-end': "_94n5u2gc _1ltvmgjw",
|
|
23
|
+
'right-start': "_1ltvu2gc _94n5mgjw",
|
|
24
|
+
'right-end': "_1ltvu2gc _154imgjw",
|
|
25
|
+
'bottom-start': "_154iu2gc _1xi2mgjw",
|
|
26
|
+
'bottom-end': "_154iu2gc _1ltvmgjw",
|
|
27
|
+
'left-start': "_1xi2u2gc _94n5mgjw",
|
|
28
|
+
'left-end': "_1xi2u2gc _154imgjw"
|
|
17
29
|
};
|
|
18
30
|
/**
|
|
19
31
|
* __Spotlight__
|
|
@@ -24,10 +36,13 @@ var styles = {
|
|
|
24
36
|
var Spotlight = exports.Spotlight = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
25
37
|
var children = _ref.children,
|
|
26
38
|
testId = _ref.testId;
|
|
27
|
-
|
|
39
|
+
var _useContext = (0, _react.useContext)(_context.SpotlightContext),
|
|
40
|
+
placement = _useContext.placement;
|
|
41
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: (0, _runtime.ax)([styles.root])
|
|
43
|
+
}, /*#__PURE__*/React.createElement(_caret.Caret, null), /*#__PURE__*/React.createElement("div", {
|
|
28
44
|
ref: ref,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}, children);
|
|
45
|
+
"data-testid": testId,
|
|
46
|
+
className: (0, _runtime.ax)([styles.card, placementStyles[placement]])
|
|
47
|
+
}, children));
|
|
33
48
|
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { createContext, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
6
|
+
export const SpotlightContext = /*#__PURE__*/createContext({
|
|
7
|
+
placement: 'bottom-end',
|
|
8
|
+
setPlacement: () => undefined
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
12
|
+
export const SpotlightContextProvider = ({
|
|
13
|
+
children
|
|
14
|
+
}) => {
|
|
15
|
+
const [placement, setPlacement] = useState('bottom-end');
|
|
16
|
+
return (
|
|
17
|
+
/*#__PURE__*/
|
|
18
|
+
// eslint-disable-next-line react/react-in-jsx-scope
|
|
19
|
+
React.createElement(SpotlightContext.Provider, {
|
|
20
|
+
value: {
|
|
21
|
+
placement,
|
|
22
|
+
setPlacement
|
|
23
|
+
}
|
|
24
|
+
}, children)
|
|
25
|
+
);
|
|
26
|
+
};
|
package/dist/es2019/index.js
CHANGED
|
@@ -6,4 +6,7 @@ export { SpotlightActions } from './ui/actions';
|
|
|
6
6
|
export { SpotlightPrimaryAction } from './ui/primary-action';
|
|
7
7
|
export { SpotlightSecondaryAction } from './ui/secondary-action';
|
|
8
8
|
export { SpotlightControls } from './ui/controls';
|
|
9
|
-
export { SpotlightDismissControl } from './ui/dismiss-control';
|
|
9
|
+
export { SpotlightDismissControl } from './ui/dismiss-control';
|
|
10
|
+
export { PopoverProvider } from './ui/popover-provider';
|
|
11
|
+
export { PopoverContent } from './ui/popover-content';
|
|
12
|
+
export { PopoverTarget } from './ui/popover-target';
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { Popper } from '@atlaskit/popper';
|
|
3
|
+
import { SpotlightContext } from '../../controllers/context';
|
|
4
|
+
/**
|
|
5
|
+
* The Spotlight card can be positioned in many different configurations, but the caret should always point to
|
|
6
|
+
* the center of the target element. `@atlaskit/popper` uses `'top' | 'right' | 'bottom' | 'left'` values for
|
|
7
|
+
* this center alignment along the respective face. So we translate between the Spotlight position, and the
|
|
8
|
+
* Popper position using this map.
|
|
9
|
+
*/
|
|
10
|
+
const popperPlacementMap = {
|
|
11
|
+
'top-start': 'top',
|
|
12
|
+
'top-end': 'top',
|
|
13
|
+
'bottom-start': 'bottom',
|
|
14
|
+
'bottom-end': 'bottom',
|
|
15
|
+
'right-start': 'right',
|
|
16
|
+
'right-end': 'right',
|
|
17
|
+
'left-start': 'left',
|
|
18
|
+
'left-end': 'left'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* __PopoverContent__
|
|
23
|
+
*
|
|
24
|
+
* A `PopoverContent` is the element that is shown as a popover.
|
|
25
|
+
*/
|
|
26
|
+
export const PopoverContent = ({
|
|
27
|
+
children,
|
|
28
|
+
placement
|
|
29
|
+
}) => {
|
|
30
|
+
const {
|
|
31
|
+
setPlacement
|
|
32
|
+
} = useContext(SpotlightContext);
|
|
33
|
+
setPlacement(placement);
|
|
34
|
+
return /*#__PURE__*/React.createElement(Popper, {
|
|
35
|
+
offset: [0, 0],
|
|
36
|
+
placement: popperPlacementMap[placement]
|
|
37
|
+
}, ({
|
|
38
|
+
ref,
|
|
39
|
+
style
|
|
40
|
+
}) =>
|
|
41
|
+
/*#__PURE__*/
|
|
42
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
43
|
+
React.createElement("div", {
|
|
44
|
+
ref: ref,
|
|
45
|
+
style: style
|
|
46
|
+
}, children));
|
|
47
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Manager } from '@atlaskit/popper';
|
|
3
|
+
import { SpotlightContextProvider } from '../../controllers/context';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* __Popover provider__
|
|
7
|
+
*
|
|
8
|
+
* A popover provider provides necesary context for the `PopoverContent` and `PopoverTarget` components.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export const PopoverProvider = ({
|
|
12
|
+
children
|
|
13
|
+
}) => {
|
|
14
|
+
return /*#__PURE__*/React.createElement(SpotlightContextProvider, null, /*#__PURE__*/React.createElement(Manager, null, children));
|
|
15
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Reference } from '@atlaskit/popper';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* __Target__
|
|
6
|
+
*
|
|
7
|
+
* A target is the element that the popover content will be positioned in relation to.
|
|
8
|
+
*/
|
|
9
|
+
export const PopoverTarget = ({
|
|
10
|
+
children
|
|
11
|
+
}) => {
|
|
12
|
+
return /*#__PURE__*/React.createElement(Reference, null, ({
|
|
13
|
+
ref
|
|
14
|
+
}) => /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
ref: ref
|
|
16
|
+
}, children));
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { forwardRef } from 'react';
|
|
6
|
+
const styles = {
|
|
7
|
+
root: "_1bsb7vkz _4t3i7vkz _t9ecjyd4 _bfhkcdhy"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* __Caret__
|
|
11
|
+
*
|
|
12
|
+
* A `Caret` is a purely visual pointer displayed on the edge of a spotlight, which points to the target element.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export const Caret = /*#__PURE__*/forwardRef(({
|
|
16
|
+
testId
|
|
17
|
+
}, ref) => {
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
"data-testid": testId,
|
|
20
|
+
ref: ref,
|
|
21
|
+
className: ax([styles.root])
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}.
|
|
3
|
-
.
|
|
2
|
+
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
3
|
+
._154iu2gc{top:var(--ds-space-100,8px)}
|
|
4
|
+
._1bsbaq3k{width:295px}
|
|
5
|
+
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
6
|
+
._1ltvu2gc{left:var(--ds-space-100,8px)}
|
|
7
|
+
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
8
|
+
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
9
|
+
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
10
|
+
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
11
|
+
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
12
|
+
._kqswh2mm{position:relative}
|
|
13
|
+
._kqswstnw{position:absolute}
|
|
@@ -2,10 +2,22 @@
|
|
|
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';
|
|
6
|
-
import {
|
|
5
|
+
import { forwardRef, useContext } from 'react';
|
|
6
|
+
import { SpotlightContext } from '../../controllers/context';
|
|
7
|
+
import { Caret } from './caret';
|
|
7
8
|
const styles = {
|
|
8
|
-
root: "
|
|
9
|
+
root: "_kqswh2mm",
|
|
10
|
+
card: "_2rkopd34 _kqswstnw _1bsbaq3k _bfhkcdhy"
|
|
11
|
+
};
|
|
12
|
+
const placementStyles = {
|
|
13
|
+
'top-start': "_94n5u2gc _1xi2mgjw",
|
|
14
|
+
'top-end': "_94n5u2gc _1ltvmgjw",
|
|
15
|
+
'right-start': "_1ltvu2gc _94n5mgjw",
|
|
16
|
+
'right-end': "_1ltvu2gc _154imgjw",
|
|
17
|
+
'bottom-start': "_154iu2gc _1xi2mgjw",
|
|
18
|
+
'bottom-end': "_154iu2gc _1ltvmgjw",
|
|
19
|
+
'left-start': "_1xi2u2gc _94n5mgjw",
|
|
20
|
+
'left-end': "_1xi2u2gc _154imgjw"
|
|
9
21
|
};
|
|
10
22
|
/**
|
|
11
23
|
* __Spotlight__
|
|
@@ -17,10 +29,14 @@ export const Spotlight = /*#__PURE__*/forwardRef(({
|
|
|
17
29
|
children,
|
|
18
30
|
testId
|
|
19
31
|
}, ref) => {
|
|
20
|
-
|
|
32
|
+
const {
|
|
33
|
+
placement
|
|
34
|
+
} = useContext(SpotlightContext);
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: ax([styles.root])
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Caret, null), /*#__PURE__*/React.createElement("div", {
|
|
21
38
|
ref: ref,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}, children);
|
|
39
|
+
"data-testid": testId,
|
|
40
|
+
className: ax([styles.card, placementStyles[placement]])
|
|
41
|
+
}, children));
|
|
26
42
|
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { createContext, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
7
|
+
export var SpotlightContext = /*#__PURE__*/createContext({
|
|
8
|
+
placement: 'bottom-end',
|
|
9
|
+
setPlacement: function setPlacement() {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
15
|
+
export var SpotlightContextProvider = function SpotlightContextProvider(_ref) {
|
|
16
|
+
var children = _ref.children;
|
|
17
|
+
var _useState = useState('bottom-end'),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
placement = _useState2[0],
|
|
20
|
+
setPlacement = _useState2[1];
|
|
21
|
+
return (
|
|
22
|
+
/*#__PURE__*/
|
|
23
|
+
// eslint-disable-next-line react/react-in-jsx-scope
|
|
24
|
+
React.createElement(SpotlightContext.Provider, {
|
|
25
|
+
value: {
|
|
26
|
+
placement: placement,
|
|
27
|
+
setPlacement: setPlacement
|
|
28
|
+
}
|
|
29
|
+
}, children)
|
|
30
|
+
);
|
|
31
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -6,4 +6,7 @@ export { SpotlightActions } from './ui/actions';
|
|
|
6
6
|
export { SpotlightPrimaryAction } from './ui/primary-action';
|
|
7
7
|
export { SpotlightSecondaryAction } from './ui/secondary-action';
|
|
8
8
|
export { SpotlightControls } from './ui/controls';
|
|
9
|
-
export { SpotlightDismissControl } from './ui/dismiss-control';
|
|
9
|
+
export { SpotlightDismissControl } from './ui/dismiss-control';
|
|
10
|
+
export { PopoverProvider } from './ui/popover-provider';
|
|
11
|
+
export { PopoverContent } from './ui/popover-content';
|
|
12
|
+
export { PopoverTarget } from './ui/popover-target';
|
|
File without changes
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { Popper } from '@atlaskit/popper';
|
|
3
|
+
import { SpotlightContext } from '../../controllers/context';
|
|
4
|
+
/**
|
|
5
|
+
* The Spotlight card can be positioned in many different configurations, but the caret should always point to
|
|
6
|
+
* the center of the target element. `@atlaskit/popper` uses `'top' | 'right' | 'bottom' | 'left'` values for
|
|
7
|
+
* this center alignment along the respective face. So we translate between the Spotlight position, and the
|
|
8
|
+
* Popper position using this map.
|
|
9
|
+
*/
|
|
10
|
+
var popperPlacementMap = {
|
|
11
|
+
'top-start': 'top',
|
|
12
|
+
'top-end': 'top',
|
|
13
|
+
'bottom-start': 'bottom',
|
|
14
|
+
'bottom-end': 'bottom',
|
|
15
|
+
'right-start': 'right',
|
|
16
|
+
'right-end': 'right',
|
|
17
|
+
'left-start': 'left',
|
|
18
|
+
'left-end': 'left'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* __PopoverContent__
|
|
23
|
+
*
|
|
24
|
+
* A `PopoverContent` is the element that is shown as a popover.
|
|
25
|
+
*/
|
|
26
|
+
export var PopoverContent = function PopoverContent(_ref) {
|
|
27
|
+
var children = _ref.children,
|
|
28
|
+
placement = _ref.placement;
|
|
29
|
+
var _useContext = useContext(SpotlightContext),
|
|
30
|
+
setPlacement = _useContext.setPlacement;
|
|
31
|
+
setPlacement(placement);
|
|
32
|
+
return /*#__PURE__*/React.createElement(Popper, {
|
|
33
|
+
offset: [0, 0],
|
|
34
|
+
placement: popperPlacementMap[placement]
|
|
35
|
+
}, function (_ref2) {
|
|
36
|
+
var ref = _ref2.ref,
|
|
37
|
+
style = _ref2.style;
|
|
38
|
+
return (
|
|
39
|
+
/*#__PURE__*/
|
|
40
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
41
|
+
React.createElement("div", {
|
|
42
|
+
ref: ref,
|
|
43
|
+
style: style
|
|
44
|
+
}, children)
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Manager } from '@atlaskit/popper';
|
|
3
|
+
import { SpotlightContextProvider } from '../../controllers/context';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* __Popover provider__
|
|
7
|
+
*
|
|
8
|
+
* A popover provider provides necesary context for the `PopoverContent` and `PopoverTarget` components.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export var PopoverProvider = function PopoverProvider(_ref) {
|
|
12
|
+
var children = _ref.children;
|
|
13
|
+
return /*#__PURE__*/React.createElement(SpotlightContextProvider, null, /*#__PURE__*/React.createElement(Manager, null, children));
|
|
14
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Reference } from '@atlaskit/popper';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* __Target__
|
|
6
|
+
*
|
|
7
|
+
* A target is the element that the popover content will be positioned in relation to.
|
|
8
|
+
*/
|
|
9
|
+
export var PopoverTarget = function PopoverTarget(_ref) {
|
|
10
|
+
var children = _ref.children;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Reference, null, function (_ref2) {
|
|
12
|
+
var ref = _ref2.ref;
|
|
13
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
14
|
+
ref: ref
|
|
15
|
+
}, children);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { forwardRef } from 'react';
|
|
6
|
+
var styles = {
|
|
7
|
+
root: "_1bsb7vkz _4t3i7vkz _t9ecjyd4 _bfhkcdhy"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* __Caret__
|
|
11
|
+
*
|
|
12
|
+
* A `Caret` is a purely visual pointer displayed on the edge of a spotlight, which points to the target element.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export var Caret = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
16
|
+
var testId = _ref.testId;
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
"data-testid": testId,
|
|
19
|
+
ref: ref,
|
|
20
|
+
className: ax([styles.root])
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}.
|
|
3
|
-
.
|
|
2
|
+
._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
3
|
+
._154iu2gc{top:var(--ds-space-100,8px)}
|
|
4
|
+
._1bsbaq3k{width:295px}
|
|
5
|
+
._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
|
|
6
|
+
._1ltvu2gc{left:var(--ds-space-100,8px)}
|
|
7
|
+
._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
|
|
8
|
+
._1xi2u2gc{right:var(--ds-space-100,8px)}
|
|
9
|
+
._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
|
|
10
|
+
._94n5u2gc{bottom:var(--ds-space-100,8px)}
|
|
11
|
+
._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
|
|
12
|
+
._kqswh2mm{position:relative}
|
|
13
|
+
._kqswstnw{position:absolute}
|
|
@@ -2,10 +2,22 @@
|
|
|
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';
|
|
6
|
-
import {
|
|
5
|
+
import { forwardRef, useContext } from 'react';
|
|
6
|
+
import { SpotlightContext } from '../../controllers/context';
|
|
7
|
+
import { Caret } from './caret';
|
|
7
8
|
var styles = {
|
|
8
|
-
root: "
|
|
9
|
+
root: "_kqswh2mm",
|
|
10
|
+
card: "_2rkopd34 _kqswstnw _1bsbaq3k _bfhkcdhy"
|
|
11
|
+
};
|
|
12
|
+
var placementStyles = {
|
|
13
|
+
'top-start': "_94n5u2gc _1xi2mgjw",
|
|
14
|
+
'top-end': "_94n5u2gc _1ltvmgjw",
|
|
15
|
+
'right-start': "_1ltvu2gc _94n5mgjw",
|
|
16
|
+
'right-end': "_1ltvu2gc _154imgjw",
|
|
17
|
+
'bottom-start': "_154iu2gc _1xi2mgjw",
|
|
18
|
+
'bottom-end': "_154iu2gc _1ltvmgjw",
|
|
19
|
+
'left-start': "_1xi2u2gc _94n5mgjw",
|
|
20
|
+
'left-end': "_1xi2u2gc _154imgjw"
|
|
9
21
|
};
|
|
10
22
|
/**
|
|
11
23
|
* __Spotlight__
|
|
@@ -16,10 +28,13 @@ var styles = {
|
|
|
16
28
|
export var Spotlight = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
29
|
var children = _ref.children,
|
|
18
30
|
testId = _ref.testId;
|
|
19
|
-
|
|
31
|
+
var _useContext = useContext(SpotlightContext),
|
|
32
|
+
placement = _useContext.placement;
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: ax([styles.root])
|
|
35
|
+
}, /*#__PURE__*/React.createElement(Caret, null), /*#__PURE__*/React.createElement("div", {
|
|
20
36
|
ref: ref,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, children);
|
|
37
|
+
"data-testid": testId,
|
|
38
|
+
className: ax([styles.card, placementStyles[placement]])
|
|
39
|
+
}, children));
|
|
25
40
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { type Dispatch, type ReactNode, type SetStateAction } from 'react';
|
|
2
|
+
import type { Placement } from '../types';
|
|
3
|
+
interface SpotlightContextType {
|
|
4
|
+
placement: Placement;
|
|
5
|
+
setPlacement: Dispatch<SetStateAction<Placement>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const SpotlightContext: React.Context<SpotlightContextType>;
|
|
8
|
+
export declare const SpotlightContextProvider: ({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export { SpotlightHeadline, type SpotlightHeadlineProps } from './ui/headline';
|
|
|
4
4
|
export { SpotlightFooter, type SpotlightFooterProps } from './ui/footer';
|
|
5
5
|
export { SpotlightActions, type SpotlightActionsProps } from './ui/actions';
|
|
6
6
|
export { SpotlightPrimaryAction, type SpotlightPrimaryActionProps } from './ui/primary-action';
|
|
7
|
-
export { SpotlightSecondaryAction, type SpotlightSecondaryActionProps } from './ui/secondary-action';
|
|
7
|
+
export { SpotlightSecondaryAction, type SpotlightSecondaryActionProps, } from './ui/secondary-action';
|
|
8
8
|
export { SpotlightControls, type SpotlightControlsProps } from './ui/controls';
|
|
9
9
|
export { SpotlightDismissControl, type SpotlightDismissControlProps } from './ui/dismiss-control';
|
|
10
|
+
export { PopoverProvider } from './ui/popover-provider';
|
|
11
|
+
export { PopoverContent } from './ui/popover-content';
|
|
12
|
+
export { PopoverTarget } from './ui/popover-target';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Placement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* __PopoverContent__
|
|
5
|
+
*
|
|
6
|
+
* A `PopoverContent` is the element that is shown as a popover.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PopoverContent: ({ children, placement, }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
placement: Placement;
|
|
11
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Popover provider__
|
|
4
|
+
*
|
|
5
|
+
* A popover provider provides necesary context for the `PopoverContent` and `PopoverTarget` components.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare const PopoverProvider: ({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Target__
|
|
4
|
+
*
|
|
5
|
+
* A target is the element that the popover content will be positioned in relation to.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PopoverTarget: ({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="react" />
|
|
6
|
+
export interface CaretProps {
|
|
7
|
+
/**
|
|
8
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
9
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
10
|
+
* serving as a hook for automated tests
|
|
11
|
+
*/
|
|
12
|
+
testId?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* __Caret__
|
|
16
|
+
*
|
|
17
|
+
* A `Caret` is a purely visual pointer displayed on the edge of a spotlight, which points to the target element.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare const Caret: import("react").ForwardRefExoticComponent<CaretProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { type Dispatch, type ReactNode, type SetStateAction } from 'react';
|
|
2
|
+
import type { Placement } from '../types';
|
|
3
|
+
interface SpotlightContextType {
|
|
4
|
+
placement: Placement;
|
|
5
|
+
setPlacement: Dispatch<SetStateAction<Placement>>;
|
|
6
|
+
}
|
|
7
|
+
export declare const SpotlightContext: React.Context<SpotlightContextType>;
|
|
8
|
+
export declare const SpotlightContextProvider: ({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -4,6 +4,9 @@ export { SpotlightHeadline, type SpotlightHeadlineProps } from './ui/headline';
|
|
|
4
4
|
export { SpotlightFooter, type SpotlightFooterProps } from './ui/footer';
|
|
5
5
|
export { SpotlightActions, type SpotlightActionsProps } from './ui/actions';
|
|
6
6
|
export { SpotlightPrimaryAction, type SpotlightPrimaryActionProps } from './ui/primary-action';
|
|
7
|
-
export { SpotlightSecondaryAction, type SpotlightSecondaryActionProps } from './ui/secondary-action';
|
|
7
|
+
export { SpotlightSecondaryAction, type SpotlightSecondaryActionProps, } from './ui/secondary-action';
|
|
8
8
|
export { SpotlightControls, type SpotlightControlsProps } from './ui/controls';
|
|
9
9
|
export { SpotlightDismissControl, type SpotlightDismissControlProps } from './ui/dismiss-control';
|
|
10
|
+
export { PopoverProvider } from './ui/popover-provider';
|
|
11
|
+
export { PopoverContent } from './ui/popover-content';
|
|
12
|
+
export { PopoverTarget } from './ui/popover-target';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Placement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { Placement } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* __PopoverContent__
|
|
5
|
+
*
|
|
6
|
+
* A `PopoverContent` is the element that is shown as a popover.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PopoverContent: ({ children, placement, }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
placement: Placement;
|
|
11
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Popover provider__
|
|
4
|
+
*
|
|
5
|
+
* A popover provider provides necesary context for the `PopoverContent` and `PopoverTarget` components.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare const PopoverProvider: ({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Target__
|
|
4
|
+
*
|
|
5
|
+
* A target is the element that the popover content will be positioned in relation to.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PopoverTarget: ({ children }: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
export interface CaretProps {
|
|
7
|
+
/**
|
|
8
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
9
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
10
|
+
* serving as a hook for automated tests
|
|
11
|
+
*/
|
|
12
|
+
testId?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* __Caret__
|
|
16
|
+
*
|
|
17
|
+
* A `Caret` is a purely visual pointer displayed on the edge of a spotlight, which points to the target element.
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare const Caret: import("react").ForwardRefExoticComponent<CaretProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/spotlight",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
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,8 @@
|
|
|
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.10.0",
|
|
36
|
+
"@atlaskit/popper": "^7.1.0",
|
|
36
37
|
"@atlaskit/primitives": "^14.11.0",
|
|
37
38
|
"@atlaskit/tokens": "^6.0.0",
|
|
38
39
|
"@babel/runtime": "^7.0.0",
|