@atlaskit/spotlight 0.0.18 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/constellation/index/examples.mdx +74 -0
  3. package/constellation/index/props.mdx +3 -3
  4. package/constellation/index/usage.mdx +127 -0
  5. package/dist/cjs/controllers/context.js +1 -58
  6. package/dist/cjs/index.js +8 -21
  7. package/dist/cjs/ui/{spotlight → card}/index.js +2 -2
  8. package/dist/cjs/ui/controls/index.compiled.css +3 -0
  9. package/dist/cjs/ui/controls/index.js +11 -5
  10. package/dist/cjs/ui/popover-content/index.compiled.css +1 -0
  11. package/dist/cjs/ui/popover-content/index.js +4 -1
  12. package/dist/es2019/controllers/context.js +0 -49
  13. package/dist/es2019/index.js +2 -3
  14. package/dist/es2019/ui/{spotlight → card}/index.js +1 -1
  15. package/dist/es2019/ui/controls/index.compiled.css +3 -0
  16. package/dist/es2019/ui/controls/index.js +12 -6
  17. package/dist/es2019/ui/popover-content/index.compiled.css +1 -0
  18. package/dist/es2019/ui/popover-content/index.js +4 -1
  19. package/dist/esm/controllers/context.js +0 -57
  20. package/dist/esm/index.js +2 -3
  21. package/dist/esm/ui/{spotlight → card}/index.js +1 -1
  22. package/dist/esm/ui/controls/index.compiled.css +3 -0
  23. package/dist/esm/ui/controls/index.js +12 -6
  24. package/dist/esm/ui/popover-content/index.compiled.css +1 -0
  25. package/dist/esm/ui/popover-content/index.js +4 -1
  26. package/dist/types/controllers/context.d.ts +0 -22
  27. package/dist/types/index.d.ts +1 -2
  28. package/dist/{types-ts4.5/ui/spotlight → types/ui/card}/index.d.ts +2 -2
  29. package/dist/types/ui/controls/index.d.ts +6 -2
  30. package/dist/types/ui/popover-target/index.d.ts +3 -3
  31. package/dist/types-ts4.5/controllers/context.d.ts +0 -22
  32. package/dist/types-ts4.5/index.d.ts +1 -2
  33. package/dist/{types/ui/spotlight → types-ts4.5/ui/card}/index.d.ts +2 -2
  34. package/dist/types-ts4.5/ui/controls/index.d.ts +6 -2
  35. package/dist/types-ts4.5/ui/popover-target/index.d.ts +3 -3
  36. package/package.json +1 -2
  37. /package/dist/cjs/ui/{spotlight → card}/caret/index.compiled.css +0 -0
  38. /package/dist/cjs/ui/{spotlight → card}/caret/index.js +0 -0
  39. /package/dist/cjs/ui/{spotlight → card}/index.compiled.css +0 -0
  40. /package/dist/es2019/ui/{spotlight → card}/caret/index.compiled.css +0 -0
  41. /package/dist/es2019/ui/{spotlight → card}/caret/index.js +0 -0
  42. /package/dist/es2019/ui/{spotlight → card}/index.compiled.css +0 -0
  43. /package/dist/esm/ui/{spotlight → card}/caret/index.compiled.css +0 -0
  44. /package/dist/esm/ui/{spotlight → card}/caret/index.js +0 -0
  45. /package/dist/esm/ui/{spotlight → card}/index.compiled.css +0 -0
  46. /package/dist/types/ui/{spotlight → card}/caret/index.d.ts +0 -0
  47. /package/dist/types-ts4.5/ui/{spotlight → card}/caret/index.d.ts +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/spotlight
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`7663adf335f3f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7663adf335f3f) -
8
+ Rename `Spotlight` to `SpotlightCard`. Removed `TourContext` - please use `useState` to manage
9
+ Spotlight visibility instead.
10
+
11
+ ## 0.1.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [`0bc8c3d1f15ee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0bc8c3d1f15ee) -
16
+ Apply `flex-direction: row-reverse;` to `SpotlightControls` to make `SpotlightDismissControl` the
17
+ first focusable element in `Spotlight`.
18
+
19
+ ### Patch Changes
20
+
21
+ - [`6fa400e1910b7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6fa400e1910b7) -
22
+ Styling update to `PopoverContent` to set `z-index: 800` to ensure `Spotlight` displays correctly
23
+ on top of Atlassian layering elements.
24
+ - Updated dependencies
25
+
3
26
  ## 0.0.18
4
27
 
5
28
  ### Patch Changes
@@ -0,0 +1,74 @@
1
+ ---
2
+ order: 0
3
+ ---
4
+
5
+ import PlacementsExample from '../../examples/constellation/placements';
6
+ import SingleStepExample from '../../examples/constellation/single-step';
7
+ import MultipleStepsExample from '../../examples/constellation/multiple-steps';
8
+ import MediaExample from '../../examples/constellation/media';
9
+ import ControlsExample from '../../examples/constellation/controls';
10
+
11
+ ## Single Step
12
+
13
+ Ideally, spotlights should only have a single step so as not to overwhelm users with too much
14
+ information. Try and combine or eliminate tasks where possible. Dismiss functionality is required.
15
+ Don't force users to participate.
16
+
17
+ By design `@atlaskit/spotlight` does not have a blanket, scroll-lock, focus-trap, or click-outside
18
+ to dismiss functionality. This is to ensure the user is not hijacked into the spotlight experience,
19
+ and can opt-in if they are interested.
20
+
21
+ To show/hide the `SpotlightCard`, simply use a `useState` to control the `isVisible` prop on
22
+ `PopoverContent`. To position the `SpotlightCard`, use `PopoverProvider`, `PopoverTarget` and
23
+ `PopoverContent` and set the `placement` prop.
24
+
25
+ <Example Component={SingleStepExample} packageName="@atlaskit/spinner" />
26
+
27
+ ## Multiple Steps/Tour
28
+
29
+ Multiple steps should be avoided if possible. Try and combine or eliminate steps where possible. If
30
+ multiple steps are required, preference managing the tour with a `useState`. As a last resort a
31
+ React context may be used. However, these contexts will often need to be wrapping the entire `App`
32
+ and therefore will cause the entire `App` to re-render every time a new spotlight step is shown.
33
+
34
+ <Example Component={MultipleStepsExample} packageName="@atlaskit/spinner" />
35
+
36
+ ## Placements
37
+
38
+ Spotlight placements are static. They do not change as the user scrolls, or if the `PopoverContent`
39
+ overflows out of the viewport. Make sure to choose a placement that ensures the `SpotlightCard` is
40
+ displayed in full.
41
+
42
+ <Example Component={PlacementsExample} packageName="@atlaskit/spinner" />
43
+
44
+ ## Media
45
+
46
+ Media is optional for a `SpotlightCard`. However if it is used it must be 295px width X 135px
47
+ height. This is to ensure correct reflow on smaller viewports.
48
+
49
+ Media can be an image, video, animation, or any other visual aid to communicate spotlight intent.
50
+
51
+ <Example Component={MediaExample} packageName="@atlaskit/spinner" />
52
+
53
+ ## Controls
54
+
55
+ `SpotlightDismissControl` is required for all `SpotlightCard` components. It **must** be the first
56
+ focusable element on the `SpotlightCard` card. This means that when defining the controls,
57
+ `SpotlightDismissControl` should appear first in the DOM order:
58
+
59
+ ```tsx
60
+ <SpotlighControls>
61
+ <SpotlightDismissControl />
62
+ <SpotlightShowMoreControl />
63
+ </SpotlighControls>
64
+ ```
65
+
66
+ Internally, `SpotlighControls` applies `flex-direction: row-reverse;` so that
67
+ `SpotlightDismissControl` visually displays after `SpotlightShowMoreControl` while maintaining
68
+ correct tabbing order.
69
+
70
+ `SpotlightShowMoreControl` is optional for `SpotlightCard` components. It should be used to allow
71
+ users to opt out of a spotlight experience, or understand why they are seeing the spotlight
72
+ experience.
73
+
74
+ <Example Component={ControlsExample} packageName="@atlaskit/spinner" />
@@ -5,7 +5,7 @@ description: A spotlight focuses attention on a specific part of the UI, like a
5
5
  props:
6
6
  packageName: '@atlaskit/spotlight'
7
7
  exports:
8
- - Spotlight
8
+ - SpotlightCard
9
9
  - SpotlightActions
10
10
  - SpotlightBody
11
11
  - SpotlightControls
@@ -23,9 +23,9 @@ props:
23
23
  - PopoverTarget
24
24
  ---
25
25
 
26
- ## Spotlight props
26
+ ## SpotlightCard props
27
27
 
28
- <TSMorphProps exportName="Spotlight" packageName="@atlaskit/spotlight" />
28
+ <TSMorphProps exportName="SpotlightCard" packageName="@atlaskit/spotlight" />
29
29
 
30
30
  ## SpotlightActions props
31
31
 
@@ -0,0 +1,127 @@
1
+ import { SingleStepSpotlightTable, MultiStepSpotlightTable } from '@af/design-system-docs-ui';
2
+
3
+ ## Usage
4
+
5
+ A spotlight focuses attention on a specific part of the UI, such as a button or icon, to educate
6
+ users about key features or workflows. Spotlights are most effective for onboarding new users,
7
+ driving feature discovery, or highlighting important changes. Use them sparingly — if your UI needs
8
+ frequent spotlights, consider simplifying the core experience instead.
9
+
10
+ ## Spotlight Scenarios
11
+
12
+ ### Top use cases
13
+
14
+ - **Onboarding new users**: Guide first-time users to essential features and workflows.
15
+ - **Feature discovery**: Help existing users learn about new or updated capabilities.
16
+
17
+ ### Growth use cases
18
+
19
+ - **Cross-flow, cross-join, co-use**: Use spotlights only when triggered by another message type
20
+ (e.g., a banner that asks for permission to “show me” before triggering a spotlight).
21
+
22
+ ### Unsupported use cases
23
+
24
+ - **Transactional**: Never use spotlights for transactional messages.
25
+
26
+ ## Guiding Principles
27
+
28
+ - **Use sparingly**: Spotlights are a Level 3 (Neutral Plus) attention component. Overuse can
29
+ distract and fatigue users.
30
+ - **One at a time**: Only show one spotlight at a time.
31
+ - **Dismissibility**: Always provide a dismiss option. Never force participation.
32
+ - **Step count**: Prefer single-step spotlights. For tours, keep flows short (2–3 steps max).
33
+ - **Orchestration**: Build spotlights with Post Office to avoid message collisions and enforce
34
+ fatigue rules (Atlassians Only).
35
+ - **Media**: Use media (images or video) only when it enhances understanding. Exclude media if the
36
+ spotlight already focuses attention effectively.
37
+
38
+ ## Anatomy & Specifications
39
+
40
+ ### Single Step Spotlight
41
+
42
+ <SingleStepSpotlightTable />
43
+ <br />
44
+
45
+ ### Multi Step Spotlight/Tour
46
+
47
+ <MultiStepSpotlightTable />
48
+ <br />
49
+
50
+ ## Visual Guidance
51
+
52
+ - **Complexity**: Match the visual complexity to the feature’s learning curve. Use text-only for
53
+ simple features, a single illustration for moderate complexity, and a narrative/motion for complex
54
+ flows.
55
+
56
+ - **Brand color**: Use solid backgrounds to focus attention. Limit to three brand colors per
57
+ composition.
58
+
59
+ - **Composition**: Highlight the focal point with size, color, and gesture lines. Use motion only if
60
+ it clarifies the feature.
61
+
62
+ ## Behavior
63
+
64
+ - **Entry points**: Spotlights should be triggered contextually and never interrupt core workflows.
65
+ For cross-product or promotional spotlights, use a less obtrusive entrypoint (like a banner)
66
+ first.
67
+
68
+ - **Tours**: Sequence steps logically. Keep flows short and focused.
69
+
70
+ ## Best Practices
71
+
72
+ - Use spotlights only when necessary to drive understanding or adoption.
73
+ - Sequence multi-step spotlights logically; aim for 2–3 steps max.
74
+ - Always allow users to dismiss or skip.
75
+ - Avoid competing with other in-product messages.
76
+ - Prefer embedded, contextual education over overlays.
77
+
78
+ ## Accessibility
79
+
80
+ - The headline is used as the accessible name for the spotlight dialog.
81
+ - Keep content concise and avoid motion that could be disruptive.
82
+ - Ensure the carat and spotlight are not truncated by the browser bounds.
83
+
84
+ ### Focus Management
85
+
86
+ #### Single step spotlights
87
+
88
+ The spotlight should **not** grab focus. Allow users to tab onto the spotlight in normal tabbing
89
+ order. By default the tabbable elements in spotlight will be ordered directly after the target
90
+ element to give screen-reader/keyboard users context about what the spotlight is related to.
91
+
92
+ The first focusable element in the spotlight should **always** be the dismiss button at the top of
93
+ the card. This will happen automatically even when a show-more button is visually ahead of it. So
94
+ product engineers shouldn't need to do any additional work.
95
+
96
+ #### Multi step spotlights
97
+
98
+ The first spotlight in a tour should **not** grab focus. Allow users to tab onto the spotlight in
99
+ normal tabbing order.
100
+
101
+ The second (and subsequent step) spotlights **should** grab focus. This is because screen-reader
102
+ users have no other method of knowing where the new spotlight steps are shown.
103
+
104
+ Once the tour completes, focus should be returned to the target element for the first step. This
105
+ allows screen-reader users to easily perform the actions just taught to them via the spotlight tour.
106
+
107
+ ## Content Guidelines
108
+
109
+ ## Headline
110
+
111
+ - Required. Begin with an active verb where possible.
112
+ - Brief and direct; communicate the main benefit.
113
+ - Limit to one line and use sentence case.
114
+
115
+ ## Body
116
+
117
+ - Required. Briefly elaborate on the intent.
118
+ - Avoid repeating the headline verb.
119
+ - Two lines max. Focus on benefits and relevance.
120
+ - Reference only visible elements.
121
+
122
+ ## CTA
123
+
124
+ - Required. One clear next action.
125
+ - Avoid plan or feature names in CTAs.
126
+ - For tours: “Next”, “Back”, “Done”.
127
+ - For features: 1–3 words; “Done” is acceptable if no clear next action.
@@ -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.TourContextProvider = exports.TourContext = exports.SpotlightContextProvider = exports.SpotlightContext = void 0;
8
+ 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); }
@@ -32,61 +32,4 @@ var SpotlightContextProvider = exports.SpotlightContextProvider = function Spotl
32
32
  setPlacement: setPlacement
33
33
  }
34
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);
92
35
  };
package/dist/cjs/index.js CHANGED
@@ -21,12 +21,6 @@ Object.defineProperty(exports, "PopoverTarget", {
21
21
  return _popoverTarget.PopoverTarget;
22
22
  }
23
23
  });
24
- Object.defineProperty(exports, "Spotlight", {
25
- enumerable: true,
26
- get: function get() {
27
- return _spotlight.Spotlight;
28
- }
29
- });
30
24
  Object.defineProperty(exports, "SpotlightActions", {
31
25
  enumerable: true,
32
26
  get: function get() {
@@ -39,6 +33,12 @@ Object.defineProperty(exports, "SpotlightBody", {
39
33
  return _body.SpotlightBody;
40
34
  }
41
35
  });
36
+ Object.defineProperty(exports, "SpotlightCard", {
37
+ enumerable: true,
38
+ get: function get() {
39
+ return _card.SpotlightCard;
40
+ }
41
+ });
42
42
  Object.defineProperty(exports, "SpotlightControls", {
43
43
  enumerable: true,
44
44
  get: function get() {
@@ -99,19 +99,7 @@ Object.defineProperty(exports, "SpotlightStepCount", {
99
99
  return _stepCount.SpotlightStepCount;
100
100
  }
101
101
  });
102
- Object.defineProperty(exports, "TourContext", {
103
- enumerable: true,
104
- get: function get() {
105
- return _context.TourContext;
106
- }
107
- });
108
- Object.defineProperty(exports, "TourContextProvider", {
109
- enumerable: true,
110
- get: function get() {
111
- return _context.TourContextProvider;
112
- }
113
- });
114
- var _spotlight = require("./ui/spotlight");
102
+ var _card = require("./ui/card");
115
103
  var _body = require("./ui/body");
116
104
  var _header = require("./ui/header");
117
105
  var _headline = require("./ui/headline");
@@ -126,5 +114,4 @@ var _showMoreControl = require("./ui/show-more-control");
126
114
  var _media = require("./ui/media");
127
115
  var _popoverProvider = require("./ui/popover-provider");
128
116
  var _popoverContent = require("./ui/popover-content");
129
- var _popoverTarget = require("./ui/popover-target");
130
- var _context = require("./controllers/context");
117
+ var _popoverTarget = require("./ui/popover-target");
@@ -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.Spotlight = void 0;
8
+ exports.SpotlightCard = void 0;
9
9
  require("./index.compiled.css");
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var React = _react;
@@ -35,7 +35,7 @@ var placementStyles = {
35
35
  * The base UI card that wraps composable spotlight components.
36
36
  *
37
37
  */
38
- var Spotlight = exports.Spotlight = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
38
+ var SpotlightCard = exports.SpotlightCard = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
39
39
  var children = _ref.children,
40
40
  testId = _ref.testId;
41
41
  var _useContext = (0, _react.useContext)(_context.SpotlightContext),
@@ -0,0 +1,3 @@
1
+
2
+ ._zulpu2gc{gap:var(--ds-space-100,8px)}._1e0c1txw{display:flex}
3
+ ._2lx21sbv{flex-direction:row-reverse}
@@ -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,9 +6,14 @@ Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.SpotlightControls = void 0;
9
+ require("./index.compiled.css");
8
10
  var _react = _interopRequireWildcard(require("react"));
9
- var _compiled = require("@atlaskit/primitives/compiled");
11
+ var React = _react;
12
+ var _runtime = require("@compiled/react/runtime");
10
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: "_zulpu2gc _1e0c1txw _2lx21sbv"
16
+ };
11
17
  /**
12
18
  * __Spotlight controls__
13
19
  *
@@ -16,10 +22,10 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
16
22
  var SpotlightControls = exports.SpotlightControls = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
17
23
  var testId = _ref.testId,
18
24
  children = _ref.children;
19
- return /*#__PURE__*/_react.default.createElement(_compiled.Flex, {
20
- testId: testId,
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ "data-testid": testId,
21
27
  ref: ref,
22
- gap: "space.100",
23
- role: "group"
28
+ role: "group",
29
+ className: (0, _runtime.ax)([styles.root])
24
30
  }, children);
25
31
  });
@@ -1,3 +1,4 @@
1
+ ._1pby1fw0{z-index:700}
1
2
  ._3um015vq{visibility:hidden}
2
3
  ._3um0ewfl{visibility:visible}
3
4
  ._lcxv1wug{pointer-events:auto}
@@ -14,6 +14,9 @@ var _popper = require("@atlaskit/popper");
14
14
  var _context = require("../../controllers/context");
15
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
16
  var styles = {
17
+ root: "_1pby1fw0"
18
+ };
19
+ var visibilityStyles = {
17
20
  visible: "_lcxv1wug _3um0ewfl",
18
21
  hidden: "_lcxvglyw _3um015vq"
19
22
  };
@@ -69,7 +72,7 @@ var PopoverContent = exports.PopoverContent = function PopoverContent(_ref) {
69
72
  return /*#__PURE__*/React.createElement("div", {
70
73
  ref: ref,
71
74
  style: style,
72
- className: (0, _runtime.ax)([styles[visibility]])
75
+ className: (0, _runtime.ax)([styles.root, visibilityStyles[visibility]])
73
76
  }, children);
74
77
  });
75
78
  };
@@ -19,53 +19,4 @@ export const SpotlightContextProvider = ({
19
19
  setPlacement
20
20
  }
21
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);
71
22
  };
@@ -1,4 +1,4 @@
1
- export { Spotlight } from './ui/spotlight';
1
+ export { SpotlightCard } from './ui/card';
2
2
  export { SpotlightBody } from './ui/body';
3
3
  export { SpotlightHeader } from './ui/header';
4
4
  export { SpotlightHeadline } from './ui/headline';
@@ -13,5 +13,4 @@ export { SpotlightShowMoreControl } from './ui/show-more-control';
13
13
  export { SpotlightMedia } from './ui/media';
14
14
  export { PopoverProvider } from './ui/popover-provider';
15
15
  export { PopoverContent } from './ui/popover-content';
16
- export { PopoverTarget } from './ui/popover-target';
17
- export { TourContext, TourContextProvider } from './controllers/context';
16
+ export { PopoverTarget } from './ui/popover-target';
@@ -27,7 +27,7 @@ const placementStyles = {
27
27
  * The base UI card that wraps composable spotlight components.
28
28
  *
29
29
  */
30
- export const Spotlight = /*#__PURE__*/forwardRef(({
30
+ export const SpotlightCard = /*#__PURE__*/forwardRef(({
31
31
  children,
32
32
  testId
33
33
  }, ref) => {
@@ -0,0 +1,3 @@
1
+
2
+ ._zulpu2gc{gap:var(--ds-space-100,8px)}._1e0c1txw{display:flex}
3
+ ._2lx21sbv{flex-direction:row-reverse}
@@ -1,5 +1,11 @@
1
- import React, { forwardRef } from 'react';
2
- import { Flex } from '@atlaskit/primitives/compiled';
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: "_zulpu2gc _1e0c1txw _2lx21sbv"
8
+ };
3
9
  /**
4
10
  * __Spotlight controls__
5
11
  *
@@ -9,10 +15,10 @@ export const SpotlightControls = /*#__PURE__*/forwardRef(({
9
15
  testId,
10
16
  children
11
17
  }, ref) => {
12
- return /*#__PURE__*/React.createElement(Flex, {
13
- testId: testId,
18
+ return /*#__PURE__*/React.createElement("div", {
19
+ "data-testid": testId,
14
20
  ref: ref,
15
- gap: "space.100",
16
- role: "group"
21
+ role: "group",
22
+ className: ax([styles.root])
17
23
  }, children);
18
24
  });
@@ -1,3 +1,4 @@
1
+ ._1pby1fw0{z-index:700}
1
2
  ._3um015vq{visibility:hidden}
2
3
  ._3um0ewfl{visibility:visible}
3
4
  ._lcxv1wug{pointer-events:auto}
@@ -6,6 +6,9 @@ import { useContext, useEffect } from 'react';
6
6
  import { Popper } from '@atlaskit/popper';
7
7
  import { SpotlightContext } from '../../controllers/context';
8
8
  const styles = {
9
+ root: "_1pby1fw0"
10
+ };
11
+ const visibilityStyles = {
9
12
  visible: "_lcxv1wug _3um0ewfl",
10
13
  hidden: "_lcxvglyw _3um015vq"
11
14
  };
@@ -62,6 +65,6 @@ export const PopoverContent = ({
62
65
  }) => /*#__PURE__*/React.createElement("div", {
63
66
  ref: ref,
64
67
  style: style,
65
- className: ax([styles[visibility]])
68
+ className: ax([styles.root, visibilityStyles[visibility]])
66
69
  }, children));
67
70
  };
@@ -24,61 +24,4 @@ export var SpotlightContextProvider = function SpotlightContextProvider(_ref) {
24
24
  setPlacement: setPlacement
25
25
  }
26
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);
84
27
  };
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { Spotlight } from './ui/spotlight';
1
+ export { SpotlightCard } from './ui/card';
2
2
  export { SpotlightBody } from './ui/body';
3
3
  export { SpotlightHeader } from './ui/header';
4
4
  export { SpotlightHeadline } from './ui/headline';
@@ -13,5 +13,4 @@ export { SpotlightShowMoreControl } from './ui/show-more-control';
13
13
  export { SpotlightMedia } from './ui/media';
14
14
  export { PopoverProvider } from './ui/popover-provider';
15
15
  export { PopoverContent } from './ui/popover-content';
16
- export { PopoverTarget } from './ui/popover-target';
17
- export { TourContext, TourContextProvider } from './controllers/context';
16
+ export { PopoverTarget } from './ui/popover-target';
@@ -27,7 +27,7 @@ var placementStyles = {
27
27
  * The base UI card that wraps composable spotlight components.
28
28
  *
29
29
  */
30
- export var Spotlight = /*#__PURE__*/forwardRef(function (_ref, ref) {
30
+ export var SpotlightCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
31
31
  var children = _ref.children,
32
32
  testId = _ref.testId;
33
33
  var _useContext = useContext(SpotlightContext),
@@ -0,0 +1,3 @@
1
+
2
+ ._zulpu2gc{gap:var(--ds-space-100,8px)}._1e0c1txw{display:flex}
3
+ ._2lx21sbv{flex-direction:row-reverse}
@@ -1,5 +1,11 @@
1
- import React, { forwardRef } from 'react';
2
- import { Flex } from '@atlaskit/primitives/compiled';
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: "_zulpu2gc _1e0c1txw _2lx21sbv"
8
+ };
3
9
  /**
4
10
  * __Spotlight controls__
5
11
  *
@@ -8,10 +14,10 @@ import { Flex } from '@atlaskit/primitives/compiled';
8
14
  export var SpotlightControls = /*#__PURE__*/forwardRef(function (_ref, ref) {
9
15
  var testId = _ref.testId,
10
16
  children = _ref.children;
11
- return /*#__PURE__*/React.createElement(Flex, {
12
- testId: testId,
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ "data-testid": testId,
13
19
  ref: ref,
14
- gap: "space.100",
15
- role: "group"
20
+ role: "group",
21
+ className: ax([styles.root])
16
22
  }, children);
17
23
  });
@@ -1,3 +1,4 @@
1
+ ._1pby1fw0{z-index:700}
1
2
  ._3um015vq{visibility:hidden}
2
3
  ._3um0ewfl{visibility:visible}
3
4
  ._lcxv1wug{pointer-events:auto}
@@ -6,6 +6,9 @@ import { useContext, useEffect } from 'react';
6
6
  import { Popper } from '@atlaskit/popper';
7
7
  import { SpotlightContext } from '../../controllers/context';
8
8
  var styles = {
9
+ root: "_1pby1fw0"
10
+ };
11
+ var visibilityStyles = {
9
12
  visible: "_lcxv1wug _3um0ewfl",
10
13
  hidden: "_lcxvglyw _3um015vq"
11
14
  };
@@ -61,7 +64,7 @@ export var PopoverContent = function PopoverContent(_ref) {
61
64
  return /*#__PURE__*/React.createElement("div", {
62
65
  ref: ref,
63
66
  style: style,
64
- className: ax([styles[visibility]])
67
+ className: ax([styles.root, visibilityStyles[visibility]])
65
68
  }, children);
66
69
  });
67
70
  };
@@ -8,26 +8,4 @@ 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;
33
11
  export {};
@@ -1,4 +1,4 @@
1
- export { Spotlight, type SpotlightProps } from './ui/spotlight';
1
+ export { SpotlightCard, type SpotlightCardProps } from './ui/card';
2
2
  export { SpotlightBody, type SpotlightBodyProps } from './ui/body';
3
3
  export { SpotlightHeader, type SpotlightHeaderProps } from './ui/header';
4
4
  export { SpotlightHeadline, type SpotlightHeadlineProps } from './ui/headline';
@@ -14,4 +14,3 @@ export { SpotlightMedia, type SpotlightMediaProps } from './ui/media';
14
14
  export { PopoverProvider } from './ui/popover-provider';
15
15
  export { PopoverContent } from './ui/popover-content';
16
16
  export { PopoverTarget } from './ui/popover-target';
17
- export { TourContext, TourContextProvider } from './controllers/context';
@@ -3,7 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { type ReactNode } from 'react';
6
- export interface SpotlightProps {
6
+ export interface SpotlightCardProps {
7
7
  /**
8
8
  * A `testId` prop is provided for specified elements, which is a unique
9
9
  * string that appears as a data attribute `data-testid` in the rendered code,
@@ -21,4 +21,4 @@ export interface SpotlightProps {
21
21
  * The base UI card that wraps composable spotlight components.
22
22
  *
23
23
  */
24
- export declare const Spotlight: import("react").ForwardRefExoticComponent<SpotlightProps & import("react").RefAttributes<HTMLDivElement>>;
24
+ export declare const SpotlightCard: import("react").ForwardRefExoticComponent<SpotlightCardProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,8 @@
1
- import React, { type ReactNode } from 'react';
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type ReactNode } from 'react';
2
6
  export interface SpotlightControlsProps {
3
7
  /**
4
8
  * A `testId` prop is provided for specified elements, which is a unique
@@ -16,4 +20,4 @@ export interface SpotlightControlsProps {
16
20
  *
17
21
  * `SpotlightControls` groups spotlight control components.
18
22
  */
19
- export declare const SpotlightControls: React.ForwardRefExoticComponent<SpotlightControlsProps & React.RefAttributes<HTMLDivElement>>;
23
+ export declare const SpotlightControls: import("react").ForwardRefExoticComponent<SpotlightControlsProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
5
  import { type ReactNode } from 'react';
6
6
  /**
7
7
  * __Target__
@@ -8,26 +8,4 @@ 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;
33
11
  export {};
@@ -1,4 +1,4 @@
1
- export { Spotlight, type SpotlightProps } from './ui/spotlight';
1
+ export { SpotlightCard, type SpotlightCardProps } from './ui/card';
2
2
  export { SpotlightBody, type SpotlightBodyProps } from './ui/body';
3
3
  export { SpotlightHeader, type SpotlightHeaderProps } from './ui/header';
4
4
  export { SpotlightHeadline, type SpotlightHeadlineProps } from './ui/headline';
@@ -14,4 +14,3 @@ export { SpotlightMedia, type SpotlightMediaProps } from './ui/media';
14
14
  export { PopoverProvider } from './ui/popover-provider';
15
15
  export { PopoverContent } from './ui/popover-content';
16
16
  export { PopoverTarget } from './ui/popover-target';
17
- export { TourContext, TourContextProvider } from './controllers/context';
@@ -3,7 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { type ReactNode } from 'react';
6
- export interface SpotlightProps {
6
+ export interface SpotlightCardProps {
7
7
  /**
8
8
  * A `testId` prop is provided for specified elements, which is a unique
9
9
  * string that appears as a data attribute `data-testid` in the rendered code,
@@ -21,4 +21,4 @@ export interface SpotlightProps {
21
21
  * The base UI card that wraps composable spotlight components.
22
22
  *
23
23
  */
24
- export declare const Spotlight: import("react").ForwardRefExoticComponent<SpotlightProps & import("react").RefAttributes<HTMLDivElement>>;
24
+ export declare const SpotlightCard: import("react").ForwardRefExoticComponent<SpotlightCardProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,8 @@
1
- import React, { type ReactNode } from 'react';
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type ReactNode } from 'react';
2
6
  export interface SpotlightControlsProps {
3
7
  /**
4
8
  * A `testId` prop is provided for specified elements, which is a unique
@@ -16,4 +20,4 @@ export interface SpotlightControlsProps {
16
20
  *
17
21
  * `SpotlightControls` groups spotlight control components.
18
22
  */
19
- export declare const SpotlightControls: React.ForwardRefExoticComponent<SpotlightControlsProps & React.RefAttributes<HTMLDivElement>>;
23
+ export declare const SpotlightControls: import("react").ForwardRefExoticComponent<SpotlightControlsProps & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
5
  import { type ReactNode } from 'react';
6
6
  /**
7
7
  * __Target__
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/spotlight",
3
- "version": "0.0.18",
3
+ "version": "0.2.0",
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",
@@ -48,7 +48,6 @@
48
48
  "@af/visual-regression": "workspace:^",
49
49
  "@atlaskit/dropdown-menu": "^16.3.0",
50
50
  "@atlaskit/ssr": "workspace:^",
51
- "@atlaskit/visual-regression": "workspace:^",
52
51
  "@testing-library/react": "^13.4.0",
53
52
  "react-dom": "^18.2.0"
54
53
  },
File without changes
File without changes