@atlaskit/spotlight 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/cjs/controllers/context.js +39 -0
  3. package/dist/cjs/index.js +7 -0
  4. package/dist/cjs/types.js +1 -5
  5. package/dist/cjs/ui/body/index.compiled.css +1 -0
  6. package/dist/cjs/ui/body/index.js +31 -0
  7. package/dist/cjs/ui/footer/index.compiled.css +0 -1
  8. package/dist/cjs/ui/footer/index.js +1 -1
  9. package/dist/cjs/ui/header/index.compiled.css +0 -2
  10. package/dist/cjs/ui/header/index.js +1 -1
  11. package/dist/cjs/ui/popover-content/index.js +28 -3
  12. package/dist/cjs/ui/popover-provider/index.js +2 -1
  13. package/dist/cjs/ui/spotlight/caret/index.compiled.css +4 -0
  14. package/dist/cjs/ui/spotlight/caret/index.js +30 -0
  15. package/dist/cjs/ui/spotlight/index.compiled.css +15 -2
  16. package/dist/cjs/ui/spotlight/index.js +23 -5
  17. package/dist/es2019/controllers/context.js +26 -0
  18. package/dist/es2019/index.js +1 -0
  19. package/dist/es2019/types.js +0 -1
  20. package/dist/es2019/ui/body/index.compiled.css +1 -0
  21. package/dist/es2019/ui/body/index.js +24 -0
  22. package/dist/es2019/ui/footer/index.compiled.css +0 -1
  23. package/dist/es2019/ui/footer/index.js +1 -1
  24. package/dist/es2019/ui/header/index.compiled.css +0 -2
  25. package/dist/es2019/ui/header/index.js +1 -1
  26. package/dist/es2019/ui/popover-content/index.js +28 -3
  27. package/dist/es2019/ui/popover-provider/index.js +4 -3
  28. package/dist/es2019/ui/popover-target/index.js +2 -2
  29. package/dist/es2019/ui/spotlight/caret/index.compiled.css +4 -0
  30. package/dist/es2019/ui/spotlight/caret/index.js +23 -0
  31. package/dist/es2019/ui/spotlight/index.compiled.css +15 -2
  32. package/dist/es2019/ui/spotlight/index.js +25 -6
  33. package/dist/esm/controllers/context.js +31 -0
  34. package/dist/esm/index.js +1 -0
  35. package/dist/esm/types.js +0 -1
  36. package/dist/esm/ui/body/index.compiled.css +1 -0
  37. package/dist/esm/ui/body/index.js +23 -0
  38. package/dist/esm/ui/footer/index.compiled.css +0 -1
  39. package/dist/esm/ui/footer/index.js +1 -1
  40. package/dist/esm/ui/header/index.compiled.css +0 -2
  41. package/dist/esm/ui/header/index.js +1 -1
  42. package/dist/esm/ui/popover-content/index.js +27 -3
  43. package/dist/esm/ui/popover-provider/index.js +4 -3
  44. package/dist/esm/ui/popover-target/index.js +2 -2
  45. package/dist/esm/ui/spotlight/caret/index.compiled.css +4 -0
  46. package/dist/esm/ui/spotlight/caret/index.js +22 -0
  47. package/dist/esm/ui/spotlight/index.compiled.css +15 -2
  48. package/dist/esm/ui/spotlight/index.js +24 -6
  49. package/dist/types/controllers/context.d.ts +11 -0
  50. package/dist/types/index.d.ts +1 -0
  51. package/dist/types/types.d.ts +1 -2
  52. package/dist/types/ui/body/index.d.ts +21 -0
  53. package/dist/types/ui/headline/index.d.ts +1 -1
  54. package/dist/types/ui/popover-provider/index.d.ts +1 -1
  55. package/dist/types/ui/popover-target/index.d.ts +1 -1
  56. package/dist/types/ui/spotlight/caret/index.d.ts +19 -0
  57. package/dist/types-ts4.5/controllers/context.d.ts +11 -0
  58. package/dist/types-ts4.5/index.d.ts +1 -0
  59. package/dist/types-ts4.5/types.d.ts +1 -2
  60. package/dist/types-ts4.5/ui/body/index.d.ts +21 -0
  61. package/dist/types-ts4.5/ui/headline/index.d.ts +1 -1
  62. package/dist/types-ts4.5/ui/popover-provider/index.d.ts +1 -1
  63. package/dist/types-ts4.5/ui/popover-target/index.d.ts +1 -1
  64. package/dist/types-ts4.5/ui/spotlight/caret/index.d.ts +19 -0
  65. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/spotlight
2
2
 
3
+ ## 0.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d972e69e6461e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d972e69e6461e) -
8
+ Create Body component. Rework spacing of Spotlight card. Minor refactoring.
9
+
10
+ ## 0.0.8
11
+
12
+ ### Patch Changes
13
+
14
+ - [`9d9570259070a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9d9570259070a) -
15
+ Create PopoverProvider, PopoverTarget, PopoverContent components.
16
+ - [`9d9570259070a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9d9570259070a) -
17
+ Create Caret component. Positions the Spotlight UI card in relation to the Caret component, and
18
+ positions the Caret component in relation to the PopoverTarget element.
19
+
3
20
  ## 0.0.7
4
21
 
5
22
  ### 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
@@ -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() {
@@ -76,6 +82,7 @@ Object.defineProperty(exports, "SpotlightSecondaryAction", {
76
82
  }
77
83
  });
78
84
  var _spotlight = require("./ui/spotlight");
85
+ var _body = require("./ui/body");
79
86
  var _header = require("./ui/header");
80
87
  var _headline = require("./ui/headline");
81
88
  var _footer = require("./ui/footer");
package/dist/cjs/types.js CHANGED
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ "use strict";
@@ -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
+ });
@@ -1,4 +1,3 @@
1
1
  ._1bsb1osq{width:100%}
2
- ._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
3
2
  ._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
4
3
  ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
@@ -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 _85i5utpp _1bsb1osq"
15
+ root: "_bozgpxbi _y4tiutpp _1bsb1osq"
16
16
  };
17
17
  /**
18
18
  * __SpotlightFooter__
@@ -1,4 +1,2 @@
1
- ._1q51utpp{padding-block-start:var(--ds-space-150,9pt)}
2
- ._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
3
1
  ._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
4
2
  ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
@@ -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 _1q51utpp _85i5utpp"
15
+ root: "_bozgpxbi _y4tiutpp"
16
16
  };
17
17
  /**
18
18
  * __SpotlightHeader__
@@ -1,12 +1,31 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.PopoverContent = void 0;
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
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
+
10
29
  /**
11
30
  * __PopoverContent__
12
31
  *
@@ -15,8 +34,14 @@ var _popper = require("@atlaskit/popper");
15
34
  var PopoverContent = exports.PopoverContent = function PopoverContent(_ref) {
16
35
  var children = _ref.children,
17
36
  placement = _ref.placement;
37
+ var _useContext = (0, _react.useContext)(_context.SpotlightContext),
38
+ setPlacement = _useContext.setPlacement;
39
+ (0, _react.useEffect)(function () {
40
+ setPlacement(placement);
41
+ }, [placement, setPlacement]);
18
42
  return /*#__PURE__*/_react.default.createElement(_popper.Popper, {
19
- placement: placement
43
+ offset: [0, 0],
44
+ placement: popperPlacementMap[placement]
20
45
  }, function (_ref2) {
21
46
  var ref = _ref2.ref,
22
47
  style = _ref2.style;
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.PopoverProvider = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _popper = require("@atlaskit/popper");
10
+ var _context = require("../../controllers/context");
10
11
  /**
11
12
  * __Popover provider__
12
13
  *
@@ -15,5 +16,5 @@ var _popper = require("@atlaskit/popper");
15
16
  */
16
17
  var PopoverProvider = exports.PopoverProvider = function PopoverProvider(_ref) {
17
18
  var children = _ref.children;
18
- return /*#__PURE__*/_react.default.createElement(_popper.Manager, null, children);
19
+ return /*#__PURE__*/_react.default.createElement(_context.SpotlightContextProvider, null, /*#__PURE__*/_react.default.createElement(_popper.Manager, null, children));
19
20
  };
@@ -0,0 +1,4 @@
1
+ ._1bsb7vkz{width:1pc}
2
+ ._4t3i7vkz{height:1pc}
3
+ ._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
4
+ ._t9ecjyd4{transform:rotate(45deg)}
@@ -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,16 @@
1
1
 
2
- ._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}._1bsbaq3k{width:295px}
3
- ._kqswh2mm{position:relative}
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)}
5
+ ._154iu2gc{top:var(--ds-space-100,8px)}
6
+ ._1bsbaq3k{width:295px}
7
+ ._1e0c1txw{display:flex}
8
+ ._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
9
+ ._1ltvu2gc{left:var(--ds-space-100,8px)}
10
+ ._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
11
+ ._1xi2u2gc{right:var(--ds-space-100,8px)}
12
+ ._2lx21bp4{flex-direction:column}
13
+ ._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
14
+ ._94n5u2gc{bottom:var(--ds-space-100,8px)}
15
+ ._kqswh2mm{position:relative}
16
+ ._kqswstnw{position:absolute}
@@ -10,10 +10,24 @@ 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");
13
14
  var _compiled = require("@atlaskit/primitives/compiled");
15
+ var _context = require("../../controllers/context");
16
+ var _caret = require("./caret");
14
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); }
15
18
  var styles = {
16
- root: "_2rkopd34 _kqswh2mm _1bsbaq3k"
19
+ root: "_kqswh2mm",
20
+ card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
21
+ };
22
+ var placementStyles = {
23
+ 'top-start': "_94n5u2gc _1xi2mgjw",
24
+ 'top-end': "_94n5u2gc _1ltvmgjw",
25
+ 'right-start': "_1ltvu2gc _94n5mgjw",
26
+ 'right-end': "_1ltvu2gc _154imgjw",
27
+ 'bottom-start': "_154iu2gc _1xi2mgjw",
28
+ 'bottom-end': "_154iu2gc _1ltvmgjw",
29
+ 'left-start': "_1xi2u2gc _94n5mgjw",
30
+ 'left-end': "_1xi2u2gc _154imgjw"
17
31
  };
18
32
  /**
19
33
  * __Spotlight__
@@ -24,10 +38,14 @@ var styles = {
24
38
  var Spotlight = exports.Spotlight = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
25
39
  var children = _ref.children,
26
40
  testId = _ref.testId;
27
- return /*#__PURE__*/React.createElement(_compiled.Box, {
41
+ var _useContext = (0, _react.useContext)(_context.SpotlightContext),
42
+ placement = _useContext.placement;
43
+ return /*#__PURE__*/React.createElement("div", {
44
+ "data-testid": testId,
28
45
  ref: ref,
29
- xcss: styles.root,
46
+ className: (0, _runtime.ax)([styles.root])
47
+ }, /*#__PURE__*/React.createElement(_caret.Caret, null), /*#__PURE__*/React.createElement(_compiled.Box, {
30
48
  backgroundColor: "color.background.neutral.bold",
31
- testId: testId
32
- }, children);
49
+ xcss: (0, _css.cx)(styles.card, placementStyles[placement])
50
+ }, children));
33
51
  });
@@ -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
+ };
@@ -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';
@@ -1 +0,0 @@
1
- export {};
@@ -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
+ });
@@ -1,4 +1,3 @@
1
1
  ._1bsb1osq{width:100%}
2
- ._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
3
2
  ._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
4
3
  ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
@@ -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 _85i5utpp _1bsb1osq"
7
+ root: "_bozgpxbi _y4tiutpp _1bsb1osq"
8
8
  };
9
9
  /**
10
10
  * __SpotlightFooter__
@@ -1,4 +1,2 @@
1
- ._1q51utpp{padding-block-start:var(--ds-space-150,9pt)}
2
- ._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
3
1
  ._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
4
2
  ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
@@ -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 _1q51utpp _85i5utpp"
7
+ root: "_bozgpxbi _y4tiutpp"
8
8
  };
9
9
  /**
10
10
  * __SpotlightHeader__
@@ -1,5 +1,23 @@
1
- import React from "react";
2
- import { Popper } from "@atlaskit/popper";
1
+ import React, { useContext, useEffect } 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
+
3
21
  /**
4
22
  * __PopoverContent__
5
23
  *
@@ -9,8 +27,15 @@ export const PopoverContent = ({
9
27
  children,
10
28
  placement
11
29
  }) => {
30
+ const {
31
+ setPlacement
32
+ } = useContext(SpotlightContext);
33
+ useEffect(() => {
34
+ setPlacement(placement);
35
+ }, [placement, setPlacement]);
12
36
  return /*#__PURE__*/React.createElement(Popper, {
13
- placement: placement
37
+ offset: [0, 0],
38
+ placement: popperPlacementMap[placement]
14
39
  }, ({
15
40
  ref,
16
41
  style
@@ -1,5 +1,6 @@
1
- import React from "react";
2
- import { Manager } from "@atlaskit/popper";
1
+ import React from 'react';
2
+ import { Manager } from '@atlaskit/popper';
3
+ import { SpotlightContextProvider } from '../../controllers/context';
3
4
 
4
5
  /**
5
6
  * __Popover provider__
@@ -10,5 +11,5 @@ import { Manager } from "@atlaskit/popper";
10
11
  export const PopoverProvider = ({
11
12
  children
12
13
  }) => {
13
- return /*#__PURE__*/React.createElement(Manager, null, children);
14
+ return /*#__PURE__*/React.createElement(SpotlightContextProvider, null, /*#__PURE__*/React.createElement(Manager, null, children));
14
15
  };
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { Reference } from "@atlaskit/popper";
1
+ import React from 'react';
2
+ import { Reference } from '@atlaskit/popper';
3
3
 
4
4
  /**
5
5
  * __Target__
@@ -0,0 +1,4 @@
1
+ ._1bsb7vkz{width:1pc}
2
+ ._4t3i7vkz{height:1pc}
3
+ ._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
4
+ ._t9ecjyd4{transform:rotate(45deg)}
@@ -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,16 @@
1
1
 
2
- ._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}._1bsbaq3k{width:295px}
3
- ._kqswh2mm{position:relative}
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)}
5
+ ._154iu2gc{top:var(--ds-space-100,8px)}
6
+ ._1bsbaq3k{width:295px}
7
+ ._1e0c1txw{display:flex}
8
+ ._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
9
+ ._1ltvu2gc{left:var(--ds-space-100,8px)}
10
+ ._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
11
+ ._1xi2u2gc{right:var(--ds-space-100,8px)}
12
+ ._2lx21bp4{flex-direction:column}
13
+ ._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
14
+ ._94n5u2gc{bottom:var(--ds-space-100,8px)}
15
+ ._kqswh2mm{position:relative}
16
+ ._kqswstnw{position:absolute}
@@ -2,10 +2,24 @@
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
- import { forwardRef } from 'react';
5
+ import { forwardRef, useContext } from 'react';
6
+ import { cx } from '@atlaskit/css';
6
7
  import { Box } from '@atlaskit/primitives/compiled';
8
+ import { SpotlightContext } from '../../controllers/context';
9
+ import { Caret } from './caret';
7
10
  const styles = {
8
- root: "_2rkopd34 _kqswh2mm _1bsbaq3k"
11
+ root: "_kqswh2mm",
12
+ card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
13
+ };
14
+ const placementStyles = {
15
+ 'top-start': "_94n5u2gc _1xi2mgjw",
16
+ 'top-end': "_94n5u2gc _1ltvmgjw",
17
+ 'right-start': "_1ltvu2gc _94n5mgjw",
18
+ 'right-end': "_1ltvu2gc _154imgjw",
19
+ 'bottom-start': "_154iu2gc _1xi2mgjw",
20
+ 'bottom-end': "_154iu2gc _1ltvmgjw",
21
+ 'left-start': "_1xi2u2gc _94n5mgjw",
22
+ 'left-end': "_1xi2u2gc _154imgjw"
9
23
  };
10
24
  /**
11
25
  * __Spotlight__
@@ -17,10 +31,15 @@ export const Spotlight = /*#__PURE__*/forwardRef(({
17
31
  children,
18
32
  testId
19
33
  }, ref) => {
20
- return /*#__PURE__*/React.createElement(Box, {
34
+ const {
35
+ placement
36
+ } = useContext(SpotlightContext);
37
+ return /*#__PURE__*/React.createElement("div", {
38
+ "data-testid": testId,
21
39
  ref: ref,
22
- xcss: styles.root,
40
+ className: ax([styles.root])
41
+ }, /*#__PURE__*/React.createElement(Caret, null), /*#__PURE__*/React.createElement(Box, {
23
42
  backgroundColor: "color.background.neutral.bold",
24
- testId: testId
25
- }, children);
43
+ xcss: cx(styles.card, placementStyles[placement])
44
+ }, children));
26
45
  });
@@ -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
@@ -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';
package/dist/esm/types.js CHANGED
@@ -1 +0,0 @@
1
- export {};
@@ -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
+ });
@@ -1,4 +1,3 @@
1
1
  ._1bsb1osq{width:100%}
2
- ._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
3
2
  ._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
4
3
  ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
@@ -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 _85i5utpp _1bsb1osq"
7
+ root: "_bozgpxbi _y4tiutpp _1bsb1osq"
8
8
  };
9
9
  /**
10
10
  * __SpotlightFooter__
@@ -1,4 +1,2 @@
1
- ._1q51utpp{padding-block-start:var(--ds-space-150,9pt)}
2
- ._85i5utpp{padding-block-end:var(--ds-space-150,9pt)}
3
1
  ._bozgpxbi{padding-inline-start:var(--ds-space-200,1pc)}
4
2
  ._y4tiutpp{padding-inline-end:var(--ds-space-150,9pt)}
@@ -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 _1q51utpp _85i5utpp"
7
+ root: "_bozgpxbi _y4tiutpp"
8
8
  };
9
9
  /**
10
10
  * __SpotlightHeader__
@@ -1,5 +1,23 @@
1
- import React from "react";
2
- import { Popper } from "@atlaskit/popper";
1
+ import React, { useContext, useEffect } 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
+
3
21
  /**
4
22
  * __PopoverContent__
5
23
  *
@@ -8,8 +26,14 @@ import { Popper } from "@atlaskit/popper";
8
26
  export var PopoverContent = function PopoverContent(_ref) {
9
27
  var children = _ref.children,
10
28
  placement = _ref.placement;
29
+ var _useContext = useContext(SpotlightContext),
30
+ setPlacement = _useContext.setPlacement;
31
+ useEffect(function () {
32
+ setPlacement(placement);
33
+ }, [placement, setPlacement]);
11
34
  return /*#__PURE__*/React.createElement(Popper, {
12
- placement: placement
35
+ offset: [0, 0],
36
+ placement: popperPlacementMap[placement]
13
37
  }, function (_ref2) {
14
38
  var ref = _ref2.ref,
15
39
  style = _ref2.style;
@@ -1,5 +1,6 @@
1
- import React from "react";
2
- import { Manager } from "@atlaskit/popper";
1
+ import React from 'react';
2
+ import { Manager } from '@atlaskit/popper';
3
+ import { SpotlightContextProvider } from '../../controllers/context';
3
4
 
4
5
  /**
5
6
  * __Popover provider__
@@ -9,5 +10,5 @@ import { Manager } from "@atlaskit/popper";
9
10
  */
10
11
  export var PopoverProvider = function PopoverProvider(_ref) {
11
12
  var children = _ref.children;
12
- return /*#__PURE__*/React.createElement(Manager, null, children);
13
+ return /*#__PURE__*/React.createElement(SpotlightContextProvider, null, /*#__PURE__*/React.createElement(Manager, null, children));
13
14
  };
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { Reference } from "@atlaskit/popper";
1
+ import React from 'react';
2
+ import { Reference } from '@atlaskit/popper';
3
3
 
4
4
  /**
5
5
  * __Target__
@@ -0,0 +1,4 @@
1
+ ._1bsb7vkz{width:1pc}
2
+ ._4t3i7vkz{height:1pc}
3
+ ._bfhkcdhy{background-color:var(--ds-background-neutral-bold,#44546f)}
4
+ ._t9ecjyd4{transform:rotate(45deg)}
@@ -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,16 @@
1
1
 
2
- ._2rkopd34{border-radius:var(--ds-border-radius-200,8px)}._1bsbaq3k{width:295px}
3
- ._kqswh2mm{position:relative}
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)}
5
+ ._154iu2gc{top:var(--ds-space-100,8px)}
6
+ ._1bsbaq3k{width:295px}
7
+ ._1e0c1txw{display:flex}
8
+ ._1ltvmgjw{left:var(--ds-space-negative-200,-1pc)}
9
+ ._1ltvu2gc{left:var(--ds-space-100,8px)}
10
+ ._1xi2mgjw{right:var(--ds-space-negative-200,-1pc)}
11
+ ._1xi2u2gc{right:var(--ds-space-100,8px)}
12
+ ._2lx21bp4{flex-direction:column}
13
+ ._94n5mgjw{bottom:var(--ds-space-negative-200,-1pc)}
14
+ ._94n5u2gc{bottom:var(--ds-space-100,8px)}
15
+ ._kqswh2mm{position:relative}
16
+ ._kqswstnw{position:absolute}
@@ -2,10 +2,24 @@
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
- import { forwardRef } from 'react';
5
+ import { forwardRef, useContext } from 'react';
6
+ import { cx } from '@atlaskit/css';
6
7
  import { Box } from '@atlaskit/primitives/compiled';
8
+ import { SpotlightContext } from '../../controllers/context';
9
+ import { Caret } from './caret';
7
10
  var styles = {
8
- root: "_2rkopd34 _kqswh2mm _1bsbaq3k"
11
+ root: "_kqswh2mm",
12
+ card: "_2rkopd34 _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
13
+ };
14
+ var placementStyles = {
15
+ 'top-start': "_94n5u2gc _1xi2mgjw",
16
+ 'top-end': "_94n5u2gc _1ltvmgjw",
17
+ 'right-start': "_1ltvu2gc _94n5mgjw",
18
+ 'right-end': "_1ltvu2gc _154imgjw",
19
+ 'bottom-start': "_154iu2gc _1xi2mgjw",
20
+ 'bottom-end': "_154iu2gc _1ltvmgjw",
21
+ 'left-start': "_1xi2u2gc _94n5mgjw",
22
+ 'left-end': "_1xi2u2gc _154imgjw"
9
23
  };
10
24
  /**
11
25
  * __Spotlight__
@@ -16,10 +30,14 @@ var styles = {
16
30
  export var Spotlight = /*#__PURE__*/forwardRef(function (_ref, ref) {
17
31
  var children = _ref.children,
18
32
  testId = _ref.testId;
19
- return /*#__PURE__*/React.createElement(Box, {
33
+ var _useContext = useContext(SpotlightContext),
34
+ placement = _useContext.placement;
35
+ return /*#__PURE__*/React.createElement("div", {
36
+ "data-testid": testId,
20
37
  ref: ref,
21
- xcss: styles.root,
38
+ className: ax([styles.root])
39
+ }, /*#__PURE__*/React.createElement(Caret, null), /*#__PURE__*/React.createElement(Box, {
22
40
  backgroundColor: "color.background.neutral.bold",
23
- testId: testId
24
- }, children);
41
+ xcss: cx(styles.card, placementStyles[placement])
42
+ }, children));
25
43
  });
@@ -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 {};
@@ -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';
@@ -1,2 +1 @@
1
- import { type Placement as ADSPopperPlacement } from "@atlaskit/popper";
2
- export type Placement = Extract<ADSPopperPlacement, "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end">;
1
+ export type Placement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end';
@@ -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>>;
@@ -9,7 +9,7 @@ export interface SpotlightHeadlineProps {
9
9
  /**
10
10
  * A brief and direct title to quickly hook the user on the intent.
11
11
  */
12
- children?: ReactNode;
12
+ children: ReactNode;
13
13
  }
14
14
  /**
15
15
  * __SpotlightHeadline__
@@ -1,4 +1,4 @@
1
- import React, { type ReactNode } from "react";
1
+ import React, { type ReactNode } from 'react';
2
2
  /**
3
3
  * __Popover provider__
4
4
  *
@@ -1,4 +1,4 @@
1
- import React, { type ReactNode } from "react";
1
+ import React, { type ReactNode } from 'react';
2
2
  /**
3
3
  * __Target__
4
4
  *
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ export interface CaretProps {
6
+ /**
7
+ * A `testId` prop is provided for specified elements, which is a unique
8
+ * string that appears as a data attribute `data-testid` in the rendered code,
9
+ * serving as a hook for automated tests
10
+ */
11
+ testId?: string;
12
+ }
13
+ /**
14
+ * __Caret__
15
+ *
16
+ * A `Caret` is a purely visual pointer displayed on the edge of a spotlight, which points to the target element.
17
+ *
18
+ */
19
+ 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 {};
@@ -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';
@@ -1,2 +1 @@
1
- import { type Placement as ADSPopperPlacement } from "@atlaskit/popper";
2
- export type Placement = Extract<ADSPopperPlacement, "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end">;
1
+ export type Placement = 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'right-start' | 'right-end' | 'left-start' | 'left-end';
@@ -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>>;
@@ -9,7 +9,7 @@ export interface SpotlightHeadlineProps {
9
9
  /**
10
10
  * A brief and direct title to quickly hook the user on the intent.
11
11
  */
12
- children?: ReactNode;
12
+ children: ReactNode;
13
13
  }
14
14
  /**
15
15
  * __SpotlightHeadline__
@@ -1,4 +1,4 @@
1
- import React, { type ReactNode } from "react";
1
+ import React, { type ReactNode } from 'react';
2
2
  /**
3
3
  * __Popover provider__
4
4
  *
@@ -1,4 +1,4 @@
1
- import React, { type ReactNode } from "react";
1
+ import React, { type ReactNode } from 'react';
2
2
  /**
3
3
  * __Target__
4
4
  *
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ export interface CaretProps {
6
+ /**
7
+ * A `testId` prop is provided for specified elements, which is a unique
8
+ * string that appears as a data attribute `data-testid` in the rendered code,
9
+ * serving as a hook for automated tests
10
+ */
11
+ testId?: string;
12
+ }
13
+ /**
14
+ * __Caret__
15
+ *
16
+ * A `Caret` is a purely visual pointer displayed on the edge of a spotlight, which points to the target element.
17
+ *
18
+ */
19
+ 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.7",
3
+ "version": "0.0.9",
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.10.0",
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",