@atlaskit/spotlight 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/constellation/index/examples.mdx +16 -15
- package/constellation/index/props.mdx +3 -3
- package/constellation/index/usage.mdx +23 -0
- package/dist/cjs/controllers/context.js +1 -58
- package/dist/cjs/index.js +8 -21
- package/dist/{es2019/ui/spotlight → cjs/ui/card}/index.compiled.css +1 -1
- package/dist/cjs/ui/{spotlight → card}/index.js +3 -3
- package/dist/es2019/controllers/context.js +0 -49
- package/dist/es2019/index.js +2 -3
- package/dist/{esm/ui/spotlight → es2019/ui/card}/index.compiled.css +1 -1
- package/dist/es2019/ui/{spotlight → card}/index.js +2 -2
- package/dist/esm/controllers/context.js +0 -57
- package/dist/esm/index.js +2 -3
- package/dist/{cjs/ui/spotlight → esm/ui/card}/index.compiled.css +1 -1
- package/dist/esm/ui/{spotlight → card}/index.js +2 -2
- package/dist/types/controllers/context.d.ts +0 -22
- package/dist/types/index.d.ts +1 -2
- package/dist/{types-ts4.5/ui/spotlight → types/ui/card}/index.d.ts +2 -2
- package/dist/types-ts4.5/controllers/context.d.ts +0 -22
- package/dist/types-ts4.5/index.d.ts +1 -2
- package/dist/{types/ui/spotlight → types-ts4.5/ui/card}/index.d.ts +2 -2
- package/package.json +4 -4
- /package/dist/cjs/ui/{spotlight → card}/caret/index.compiled.css +0 -0
- /package/dist/cjs/ui/{spotlight → card}/caret/index.js +0 -0
- /package/dist/es2019/ui/{spotlight → card}/caret/index.compiled.css +0 -0
- /package/dist/es2019/ui/{spotlight → card}/caret/index.js +0 -0
- /package/dist/esm/ui/{spotlight → card}/caret/index.compiled.css +0 -0
- /package/dist/esm/ui/{spotlight → card}/caret/index.js +0 -0
- /package/dist/types/ui/{spotlight → card}/caret/index.d.ts +0 -0
- /package/dist/types-ts4.5/ui/{spotlight → card}/caret/index.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/spotlight
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3b5b4a919aaaf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3b5b4a919aaaf) -
|
|
8
|
+
Internal changes to how border radius is applied.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 0.2.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`7663adf335f3f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7663adf335f3f) -
|
|
16
|
+
Rename `Spotlight` to `SpotlightCard`. Removed `TourContext` - please use `useState` to manage
|
|
17
|
+
Spotlight visibility instead.
|
|
18
|
+
|
|
3
19
|
## 0.1.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -14,9 +14,13 @@ Ideally, spotlights should only have a single step so as not to overwhelm users
|
|
|
14
14
|
information. Try and combine or eliminate tasks where possible. Dismiss functionality is required.
|
|
15
15
|
Don't force users to participate.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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.
|
|
20
24
|
|
|
21
25
|
<Example Component={SingleStepExample} packageName="@atlaskit/spinner" />
|
|
22
26
|
|
|
@@ -31,20 +35,16 @@ and therefore will cause the entire `App` to re-render every time a new spotligh
|
|
|
31
35
|
|
|
32
36
|
## Placements
|
|
33
37
|
|
|
34
|
-
Spotlight placements are static
|
|
35
|
-
overflows out of the viewport. Make sure to choose a placement that ensures the `
|
|
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
|
|
36
40
|
displayed in full.
|
|
37
41
|
|
|
38
|
-
By design `@atlaskit/spotlight` does not have a blanket, scroll-lock, focus-trap, or click-outside
|
|
39
|
-
to dismiss functionality. This is to ensure the user is not hijacked into the spotlight experience,
|
|
40
|
-
and can opt-in if they are interested.
|
|
41
|
-
|
|
42
42
|
<Example Component={PlacementsExample} packageName="@atlaskit/spinner" />
|
|
43
43
|
|
|
44
44
|
## Media
|
|
45
45
|
|
|
46
|
-
Media is optional for a `
|
|
47
|
-
This is to ensure correct reflow on smaller viewports.
|
|
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
48
|
|
|
49
49
|
Media can be an image, video, animation, or any other visual aid to communicate spotlight intent.
|
|
50
50
|
|
|
@@ -52,8 +52,8 @@ Media can be an image, video, animation, or any other visual aid to communicate
|
|
|
52
52
|
|
|
53
53
|
## Controls
|
|
54
54
|
|
|
55
|
-
`SpotlightDismissControl` is required for all `
|
|
56
|
-
focusable element on the `
|
|
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
57
|
`SpotlightDismissControl` should appear first in the DOM order:
|
|
58
58
|
|
|
59
59
|
```tsx
|
|
@@ -67,7 +67,8 @@ Internally, `SpotlighControls` applies `flex-direction: row-reverse;` so that
|
|
|
67
67
|
`SpotlightDismissControl` visually displays after `SpotlightShowMoreControl` while maintaining
|
|
68
68
|
correct tabbing order.
|
|
69
69
|
|
|
70
|
-
`SpotlightShowMoreControl` is optional for `
|
|
71
|
-
to opt out of a spotlight experience, or understand why they are seeing the spotlight
|
|
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.
|
|
72
73
|
|
|
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
|
-
-
|
|
8
|
+
- SpotlightCard
|
|
9
9
|
- SpotlightActions
|
|
10
10
|
- SpotlightBody
|
|
11
11
|
- SpotlightControls
|
|
@@ -23,9 +23,9 @@ props:
|
|
|
23
23
|
- PopoverTarget
|
|
24
24
|
---
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## SpotlightCard props
|
|
27
27
|
|
|
28
|
-
<TSMorphProps exportName="
|
|
28
|
+
<TSMorphProps exportName="SpotlightCard" packageName="@atlaskit/spotlight" />
|
|
29
29
|
|
|
30
30
|
## SpotlightActions props
|
|
31
31
|
|
|
@@ -81,6 +81,29 @@ frequent spotlights, consider simplifying the core experience instead.
|
|
|
81
81
|
- Keep content concise and avoid motion that could be disruptive.
|
|
82
82
|
- Ensure the carat and spotlight are not truncated by the browser bounds.
|
|
83
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
|
+
|
|
84
107
|
## Content Guidelines
|
|
85
108
|
|
|
86
109
|
## Headline
|
|
@@ -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.
|
|
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
|
-
|
|
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");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
.
|
|
2
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
3
3
|
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
4
|
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154i12x7{top:var(--ds-space-075,6px)}
|
|
5
5
|
._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
@@ -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.
|
|
8
|
+
exports.SpotlightCard = void 0;
|
|
9
9
|
require("./index.compiled.css");
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var React = _react;
|
|
@@ -17,7 +17,7 @@ var _caret = require("./caret");
|
|
|
17
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); }
|
|
18
18
|
var styles = {
|
|
19
19
|
root: "_kqswh2mm",
|
|
20
|
-
card: "
|
|
20
|
+
card: "_2rko1mok _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
21
21
|
};
|
|
22
22
|
var placementStyles = {
|
|
23
23
|
'top-start': "_94n512x7 _1xi2mgjw",
|
|
@@ -35,7 +35,7 @@ var placementStyles = {
|
|
|
35
35
|
* The base UI card that wraps composable spotlight components.
|
|
36
36
|
*
|
|
37
37
|
*/
|
|
38
|
-
var
|
|
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),
|
|
@@ -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
|
};
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
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';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
.
|
|
2
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
3
3
|
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
4
|
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154i12x7{top:var(--ds-space-075,6px)}
|
|
5
5
|
._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
@@ -9,7 +9,7 @@ import { SpotlightContext } from '../../controllers/context';
|
|
|
9
9
|
import { Caret } from './caret';
|
|
10
10
|
const styles = {
|
|
11
11
|
root: "_kqswh2mm",
|
|
12
|
-
card: "
|
|
12
|
+
card: "_2rko1mok _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
13
13
|
};
|
|
14
14
|
const placementStyles = {
|
|
15
15
|
'top-start': "_94n512x7 _1xi2mgjw",
|
|
@@ -27,7 +27,7 @@ const placementStyles = {
|
|
|
27
27
|
* The base UI card that wraps composable spotlight components.
|
|
28
28
|
*
|
|
29
29
|
*/
|
|
30
|
-
export const
|
|
30
|
+
export const SpotlightCard = /*#__PURE__*/forwardRef(({
|
|
31
31
|
children,
|
|
32
32
|
testId
|
|
33
33
|
}, ref) => {
|
|
@@ -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 {
|
|
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';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
.
|
|
2
|
+
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
3
3
|
._zulppxbi{gap:var(--ds-space-200,1pc)}
|
|
4
4
|
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._154i12x7{top:var(--ds-space-075,6px)}
|
|
5
5
|
._154imgjw{top:var(--ds-space-negative-200,-1pc)}
|
|
@@ -9,7 +9,7 @@ import { SpotlightContext } from '../../controllers/context';
|
|
|
9
9
|
import { Caret } from './caret';
|
|
10
10
|
var styles = {
|
|
11
11
|
root: "_kqswh2mm",
|
|
12
|
-
card: "
|
|
12
|
+
card: "_2rko1mok _zulppxbi _1rjcutpp _kqswstnw _1bsbaq3k _1e0c1txw _2lx21bp4"
|
|
13
13
|
};
|
|
14
14
|
var placementStyles = {
|
|
15
15
|
'top-start': "_94n512x7 _1xi2mgjw",
|
|
@@ -27,7 +27,7 @@ var placementStyles = {
|
|
|
27
27
|
* The base UI card that wraps composable spotlight components.
|
|
28
28
|
*
|
|
29
29
|
*/
|
|
30
|
-
export var
|
|
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),
|
|
@@ -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 {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
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
|
|
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
|
|
24
|
+
export declare const SpotlightCard: import("react").ForwardRefExoticComponent<SpotlightCardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -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 {
|
|
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
|
|
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
|
|
24
|
+
export declare const SpotlightCard: import("react").ForwardRefExoticComponent<SpotlightCardProps & import("react").RefAttributes<HTMLDivElement>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/spotlight",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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,11 +32,11 @@
|
|
|
32
32
|
"@atlaskit/button": "^23.4.0",
|
|
33
33
|
"@atlaskit/css": "^0.12.0",
|
|
34
34
|
"@atlaskit/heading": "^5.2.0",
|
|
35
|
-
"@atlaskit/icon": "^28.
|
|
35
|
+
"@atlaskit/icon": "^28.1.0",
|
|
36
36
|
"@atlaskit/image": "^3.0.0",
|
|
37
37
|
"@atlaskit/popper": "^7.1.0",
|
|
38
|
-
"@atlaskit/primitives": "^14.
|
|
39
|
-
"@atlaskit/tokens": "^6.
|
|
38
|
+
"@atlaskit/primitives": "^14.12.0",
|
|
39
|
+
"@atlaskit/tokens": "^6.1.0",
|
|
40
40
|
"@babel/runtime": "^7.0.0",
|
|
41
41
|
"@compiled/react": "^0.18.3"
|
|
42
42
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|